Advertisement

CSS Triangle Generator

CSS Output

How CSS Triangles Work

CSS triangles use a clever border trick: a zero-width, zero-height element with three transparent borders and one colored border creates a perfect triangle shape.

The Border Trick Explained

Example: Downward Arrow

Common Use Cases

Why use CSS triangles instead of images?

CSS triangles are resolution-independent (sharp at any DPI), require no HTTP requests, can be colored with a single CSS variable, and are animatable with transitions. They're zero-maintenance compared to images.

Can I make isosceles or right-angle triangles?

Yes — control the shape by varying the two transparent border widths. Equal widths give an isosceles triangle; unequal widths skew it. For right-angle triangles, set one transparent border to zero.

Should I use CSS triangles or SVG?

For simple arrows and decorative shapes, CSS is simpler and faster. For complex shapes, custom paths, or triangles that need to be interactive, SVG is more flexible. Both are resolution-independent and faster than raster images.