title: How do CSS triangles work?
body: <p>There're plenty of different CSS shapes over at <a href="http://css-tricks.com/examples/ShapesOfCSS/" rel="noreferrer">CSS Tricks - Shapes of CSS</a> and I'm particularly puzzled with a triangle:</p>
  
  <p><img src="https://i.stack.imgur.com/Zcyzo.png" alt="CSS Triangle"></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>#triangle-up {
    width: 0;
    height: 0;
    border-left: 50px solid transparent;
    border-right: 50px solid transparent;
    border-bottom: 100px solid red;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div id="triangle-up"&gt;&lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>How and why does it work?</p>