Generate a CSS triangle for tooltips, dropdown carets, speech bubbles and arrows. Choose one of eight directions, set the width, height and color, and copy CSS that uses either the classic zero-size border trick — which works everywhere — or clip-path, which can be filled with a gradient or image. It's free, runs in your browser, and nothing is sent anywhere.
| Pointing | Colored border | Transparent borders |
|---|---|---|
| Up | bottom | left, right |
| Down | top | left, right |
| Left | right | top, bottom |
| Right | left | top, bottom |
A box with no width or height has borders that meet diagonally. Color one border, make its neighbors transparent, and what's left is a triangle pointing away from the colored side.
Borders work everywhere but only in a solid color. clip-path triangles can have gradients, images and shadows via filter: drop-shadow.
Put it on the tooltip's ::before or ::after with position: absolute and paste the declarations from here.
Not with box-shadow. Use filter: drop-shadow() on it or its parent, or use the clip-path version.
No. The CSS is generated in your browser.
The classic CSS triangle is a box with zero width and height whose borders meet at angles. Coloring one border and making the two next to it transparent leaves a triangle pointing away from the colored side — so an upward triangle has a colored bottom border, which is the detail people most often get backwards. For up and down, the left and right borders are each half the base width and the colored border sets the height; left and right swap the axes. Corner triangles use just two borders, one colored and one transparent. This technique works in every browser ever made but can only be a flat color. The alternative is a normally sized box clipped with clip-path: polygon(), which can take gradients, images and filters. The generator writes either, from the same direction, width, height and color.