A CSS speech bubble generator creates a rounded box and a triangular pointer with CSS borders, then returns a relatively positioned class plus an absolutely positioned ::after pseudo-element. The CSS Speech Bubble Generator uses that structure to produce a focused callout or message shape without requiring an image, SVG asset, account, or new dependency.
This is a shape generator rather than a complete chat or tooltip component. It configures the bubble surface, colors, rounded corners, tail size, and tail direction. Your project still supplies the content, layout, semantic HTML, interaction behavior, and responsive rules needed to fit the bubble into a real interface.

The output has two coordinated layers
The base class defines the visible message surface. It receives the selected bubble and text colors, the chosen corner radius, and relative positioning. Relative positioning establishes the reference for the tail, allowing the pseudo-element to be placed against one edge of the bubble.
The ::after pseudo-element creates the pointer without additional production markup. It has zero width and height, uses borders to form a triangle, and is positioned absolutely on the selected side. The copied CSS expresses this production form.
| Layer | Role in the result |
|---|---|
| Base class | Creates the rounded bubble surface and provides the positioning context for the tail. |
| ::after pseudo-element | Builds the triangle from transparent and bubble-colored borders. |
| Preview child element | Displays the same geometry in the preview because inline styles cannot target a pseudo-element. |
That preview distinction is important: the live preview uses a real child element, while the copied rule uses ::after. Both paths use the same validated size, color, side, and offset calculation, so the preview is a geometric representation of the rule you copy into production.
How the border triangle is built
The technique relies on standard CSS border behavior described in the CSS Borders specification. It also follows the styling model documented in MDN’s border-style reference. The triangle starts with an element whose width and height are both zero. Adjacent borders are made transparent, while the border opposite the selected direction receives the bubble color.
| Selected tail | Colored border | Transparent borders | Pointer placement |
|---|---|---|---|
| Bottom | Top | Left and right | Below the bubble, centered horizontally |
| Top | Bottom | Left and right | Above the bubble, centered horizontally |
| Left | Right | Top and bottom | Beside the bubble, centered vertically |
| Right | Left | Top and bottom | Beside the bubble, centered vertically |
Tail size controls both the visible projection and half of the triangle’s base. In other words, the projection equals the selected tail size, while the full base is twice that size. The generator writes explicit declarations so the geometry remains understandable when inspected in browser developer tools.
The pointer is centered on its selected side through absolute positioning. If it needs to line up with an avatar, quotation mark, or other anchor instead, adjust the copied 50% position after generation. The generator itself provides a centered pointer; custom offsets are outside its focused output.
Build a speech bubble in four steps
- Choose the bubble and text colors. Open the generator and enter a complete six-digit hexadecimal value for each color. Empty color fields are not valid. The bubble color becomes the surface color and the pointer color, while the text color is applied to content placed inside the bubble.
- Set the radius and tail size. Choose a corner radius from 0 through 80 pixels and a tail size from 4 through 40 pixels. A radius of 0 is allowed for square corners. Empty numeric controls are rejected rather than silently becoming zero, so enter an explicit value before continuing.
- Select a direction and inspect the preview. Choose top, right, bottom, or left, then check the bubble’s proportions and the pointer’s position. The preview renders a child-based triangle because inline styles cannot directly style a pseudo-element, but its geometry matches the production rule. Confirm that the text remains readable and that the pointer appears on the intended side.
- Copy the CSS and complete the component. Copy both the base class and the complete pseudo-element rule into your stylesheet. Then add the actual content, layout, semantic structure, contrast treatment, and responsive spacing. The generated CSS intentionally omits padding, width, typography, animation, and interaction logic because those concerns belong to the component using the shape.
Adapt the copied rule without breaking the tail
Keep the base class relatively positioned and the pseudo-element absolutely positioned. If either relationship is removed, the triangle may no longer be positioned relative to the bubble surface. When applying the rule to an existing design system, replace generated color and radius values with your project tokens where appropriate, while retaining the geometry needed by the border technique.
The generated rule is intentionally narrow. It does not include a maximum width, text wrapping rules, padding, or a spacing value around the pointer. Those omissions allow the shape to be reused, but they also mean that the copied CSS alone is not a complete interface component.
| Concern | Generator result | Developer responsibility |
|---|---|---|
| Shape and colors | Provides the rounded surface, triangle, radius, and selected colors | Adjust the copied 50% position if the pointer must target a specific anchor |
| Content layout | Omits width, maximum width, padding, wrapping, and typography | Add rules suited to the message length and available container |
| Semantics | Produces only the visual shape | Choose appropriate elements and expose message details in text |
| Interaction and responsiveness | Omits animation, dismissal, focus behavior, and breakpoint rules | Implement and test the complete component |
Use the shape responsibly in a page
A decorative pointer does not create a semantic relationship between the bubble and another element. The shape can improve visual orientation, but the document structure and accessible name still need to explain what the content means.
- Use a paragraph for a quotation, a list item for a message, and other suitable HTML according to the content’s purpose.
- For chat messages, expose the author, message order, delivery status, and timestamps in text. A user should not have to infer those details from left-versus-right placement.
- Do not treat a generated bubble as a tooltip merely because it has a pointer. A tooltip pattern requires an accessible association with its trigger, keyboard reachability, sensible focus behavior, and predictable dismissal.
Interactive tooltips also need to work with assistive technology and keyboard-only navigation. Adding the visual tail does not satisfy any of those interaction or accessibility requirements.
Protect contrast and layout
Check the contrast between the text and the selected bubble background. The generator does not calculate WCAG contrast ratios, so a visually pleasant pairing can still be difficult to read. Test the final colors against the component’s real background and consider high-contrast modes.
- Give the component a sensible maximum width, wrapping rules, padding, and enough outer space on the tail side.
- Expect long unbroken strings, translated copy, browser zoom, and narrow mobile widths to expand the bubble or cause a collision with the pointer.
- Check every ancestor for clipping. A parent with overflow: hidden can cut off a pointer that extends beyond the bubble.
- Reserve room in the exact container that will host the component and inspect the result at each relevant responsive breakpoint.
- Test semantic reading order, keyboard behavior where relevant, localization, zoom, overflow, and forced-color or high-contrast presentation.
Know the generator’s focused limits
The supported output is a rounded message surface with one border-built triangular pointer. It does not generate custom offsets, multiple pointers, curved tails, outlines, or drop shadows. The tail is centered on its selected side, and the only manual alignment adjustment described here is changing the copied 50% position after the rule has been generated.
All geometry calculations happen locally and deterministically. Nothing is uploaded or retained, and no account is required. This keeps the generated CSS easy to inspect and prevents the tool from introducing a separate runtime dependency.
Treat the result as a reusable visual primitive. Preserve its relative base and absolute pseudo-element, add an appropriate semantic host, and test the complete component in the container where it will appear.
For a deeper look, see CSS Stripes Generator Example: From Inputs to CSS.
For a deeper look, see CSS Speech Bubble Generator for Beginners: Build One.