Skip to main content

CSS Triangle Generator

Create pure CSS triangles using the border technique.
Choose a direction, customize the size and color, then copy the code.

100px
100px
.triangle {
  width: 0;
  height: 0;
  border-left: 50px solid transparent;
  border-right: 50px solid transparent;
  border-bottom: 100px solid #3b82f6;
}

How CSS Triangles Work

CSS triangles are created using the border property trick. By setting the width and height to 0 and using transparent borders on adjacent sides, the visible border forms a triangle shape. This technique works in all browsers and requires no images.