How (and why) to use borders to make a CSS triangle (plus a scss mixin)

Kevin Powell on YouTubeWatch on YouTube

SaveMark complete

Sign in to save videos and track what you’ve finished.

IntermediateUI19 min

About this video

Shows how to build a CSS triangle using element borders, explains why the technique works, and then wraps it in a Sass mixin so triangles can be created with a single line of code. Aimed at people who already write HTML and CSS.

What you’ll learn

  • Create a CSS triangle by manipulating element borders
  • Explain how border widths and colours shape the triangle
  • Write a Sass mixin that generates triangles in one line