Files
30-seconds-of-code/snippets/triangle.md
Angelos Chalaris 2fbd3e0737 Update format
2020-04-30 13:21:04 +03:00

575 B

title, tags
title tags
Triangle visual,beginner

Creates a triangle shape with pure CSS.

  • The color of the border is the color of the triangle. The side the triangle tip points corresponds to the opposite border-* property. For example, a color on border-top means the arrow points downward.
  • Experiment with the px values to change the proportion of the triangle.
<div class="triangle"></div>
.triangle {
  width: 0;
  height: 0;
  border-top: 20px solid #333;
  border-left: 20px solid transparent;
  border-right: 20px solid transparent;
}