CSS Triangle Generator
CSS Triangle Generator generates the CSS for triangles pointing up, down, left, right and into the four corners using the pure-CSS border trick (a zero-size element with transparent borders). Set the width, height and color and see it live; ideal for tooltip arrows and dropdown carets.
width: 0; height: 0; border-left: 50px solid transparent; border-right: 50px solid transparent; border-bottom: 80px solid #6366f1;
How it works
- 1Choose the triangle's direction.
- 2Set the width, height and color.
- 3Copy the CSS with "Copy CSS" and apply it to an element (or an ::after pseudo-element).
Frequently asked questions
How does this technique work?−+
The element has zero width and height; since borders meet along diagonals, coloring one border and leaving its neighbours transparent forms a triangle.
Can I add a shadow or border to the triangle?−+
box-shadow does not work directly; use filter: drop-shadow() or clip-path instead.
How is it different from clip-path?−+
The border technique works in old browsers and does not clip the element's box to a triangle; clip-path is more flexible (gradient fills, shadows, any shape).
Embed on your site
<iframe src="https://toolsqube.com/en/color/css-triangle-generator/embed" width="480" height="360" style="border:0;border-radius:14px" title="CSS Triangle Generator · ToolsQube" loading="lazy"> </iframe>
Want to go deeper on this topic: Color and Design Guide →