801 B
801 B
title, tags, firstSeen, lastUpdated
| title | tags | firstSeen | lastUpdated |
|---|---|---|---|
| Triangle | visual,beginner | 2018-02-25T15:14:39+02:00 | 2021-01-07T23:52:15+02:00 |
Creates a triangular shape with pure CSS.
- Use three borders to create a triangle shape.
- All borders should have the same
border-width(20px). - The opposite side of where the triangle points towards (i.e. top if the triangle points downwards) should have the desired
border-color, whereas the adjacent borders (i.e. left and right) should have aborder-coloroftransparent. - Altering the
border-widthvalues will change the proportions of the triangle.
<div class="triangle"></div>
.triangle {
width: 0;
height: 0;
border-top: 20px solid #9C27B0;
border-left: 20px solid transparent;
border-right: 20px solid transparent;
}