title: Scrollable element inside a container filling remaining space
body: <p>I have a container flexbox element filling the remaining space inside a container. Inside that, I want an element that can fill the parent and scroll on overflow. Problem is, is always just overflows the container, and I can't set <code>height: 100%</code>, since that won't take into account a header with a dynamic height.</p>
  <p>Please see this code snippet for a clearer example. I want to scroll on the purple div, but the red div keeps overflowing the blue div, which it shouldn't. I would highly prefer to not change the HTML, only the CSS.</p>
  <p><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>html,
  body {
    height: 100%;
    margin: 0;
    padding: 0;
  }
  
  .wrapper {
    height: 100%;
    padding: 10px;
    box-sizing: border-box;
    background: blue;
    width: 300px;
    display: flex;
    flex-direction: column;
  }
  
  .header {
    padding: 10px;
    background: green;
  }
  
  .content {
    padding: 10px;
    background: red;
    flex: 1;
    box-sizing: border-box;
  }
  
  .boxes {
    padding: 10px;
    background: purple;
    height: 100%;
    overflow-y: auto;
    box-sizing: border-box;
  }
  
  .box {
    height: 200px;
    border: 1px solid black;
    box-sizing: border-box;
    background: orange;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="wrapper"&gt;
    &lt;div class="header"&gt;
      This is the header.
      It has multiple lines.
    &lt;/div&gt;
    &lt;div class="content"&gt;
      &lt;div class="boxes"&gt;
        &lt;div class="box"&gt;&lt;/div&gt;
        &lt;div class="box"&gt;&lt;/div&gt;
        &lt;div class="box"&gt;&lt;/div&gt;
        &lt;div class="box"&gt;&lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>