title: Draw triangle in corner of div
body: <p>I'd like to draw some kind of triangle in the corner of a div. Because I don't want to use &quot;px&quot; I'd like to achieve the same result also with percentage values.</p>
  <p>This is what it should looks like:</p>
  <p><a href="https://i.stack.imgur.com/DI8KN.png" rel="noreferrer"><img src="https://i.stack.imgur.com/DI8KN.png" alt="img" /></a>
  <div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.container {
    position: absolute; 
    top: 5%; 
    left: 5%; 
    width: 60%; 
    height: 30%; 
    background: black; 
    color: white;
    border-radius: 12px;
    overflow: hidden;
  }
  
  .triangle {
    position: relative;
    top: 10%;
    left: 90%;
    width: 10%;
    height: 10%;
    -webkit-transform: rotate(45deg);
    background: green;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="container"&gt;
    &lt;div class="triangle"&gt;&lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  <p>Any help would be very appreciated. Thanks in advance!!</p>