Back to all tools

CSS Triangle Generator

Generate high-performance CSS shapes for tooltips and UI components.

Direction

Color

Dimensions

100px
100px
Copy CSS

CSS Output

width: 0;
height: 0;
border-left: 50px solid transparent;
border-right: 50px solid transparent;
border-bottom: 100px solid #4f46e5;

How CSS Triangles Work

1

Border Hack

CSS triangles aren't "real" shapes ΓÇö they use zero-width elements and thick transparent borders to create angles.

2

Directional Logic

To point up, the bottom border is colored while the left and right borders are transparent.

3

Copy to CSS

Copy the generated properties and apply them to any div or pseudo-element (::before/::after).

Frequently Asked Questions

Why is the width and height 0?

When the content width and height are 0, the borders meet at the center. By making some borders transparent and one solid, a triangle is formed from the border width.

Can I use these for tooltips?

Yes, this is the most common use case. Developers often use these triangles on pseudo-elements to create directional arrows for tooltip bubbles.

Are they responsive?

Since the sizes are defined in pixels, you can easily use CSS variables or media queries to change the triangle size across different screen sizes.