CSS Triangle Generator
Create pure CSS triangles using borders.
CSS Triangle Generator
Create pure CSS triangles in eight directions with adjustable dimensions, color, and copyable code.
.triangle {
width: 0;
height: 0;
border-style: solid;
border-width: 0 50px 100px 50px;
border-color: transparent transparent oklch(var(--p)) transparent;
}Features
- Eight cardinal and diagonal directions
- Independent width and height controls
- Custom color with live preview
- Copyable zero-size border CSS
The border trick is ideal for small carets, arrows, and tooltip pointers; use clip-path for complex or animated shapes.
CSS triangle FAQ
How are CSS triangles made?
A zero-width, zero-height element uses one colored border and transparent neighboring borders to form a triangle.
When should I use clip-path?
Use clip-path when you need a real box, gradients, complex polygons, or animation rather than a simple border triangle.