title: Fill available height, then scroll when no more room
body: <p>I would like two elements (divs) in a column. The first has a fixed height, and the second I want to fill all remaining height. If the content of the second element exceeds the space left, I want to scroll its contents, and not have the second element take up more space (which causes the parent to scroll).</p>
  
  <p><a href="https://imgur.com/HpRuhSj" rel="nofollow noreferrer">Image (current)</a>
  For example, the "first element" is the search bar in this photo. Fixed height, and remains on top.</p>
  
  <p>The "second element" is the data table. As you can see at the bottom, the table contents extend the height of the page, and the entire page becomes scrollable. This is not what I am looking for. </p>
  
  <p><a href="https://i.imgur.com/zLTuPpp.png" rel="nofollow noreferrer">Image (desired)</a> I would like the table container to behave similarly to this red box. It fills it's remaining height, and when it contains content that overflows, I would like just that element to scroll. Only scroll the content within the confines of the red box. </p>
  
  <p>I have seen many examples similar to this, but all of them have a specified height for the "second element", even if it is a <code>vh</code> property. <code>vh</code> doesn't work for me since the 100% isn't the entire viewport. </p>
  
  <p>I've been using flexbox to try and achieve this, and I get close, but I've only ever been able to either specify a height for the "second element", or have it grow to fill available space, but then exceed it, and overflow the whole container. </p>
  
  <p>The below code is very close to desired behavior, except when the viewport becomes to small, "box 2" goes off screen and the whole thing scrolls, I want the content in "box 2" to scroll.</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%;
  }
  
  .container {
    height: 100%;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    .box {
      text-align: center;
      color: white;
      font-family: sans-serif;
      font-size: 36px;
      padding: 20px;
      display: flex;
      flex-direction: column;
      justify-content: center;
    }
    .box-1 {
      background-color: green;
      height: 60px;
    }
    .box-2 {
      background-color: blue;
      flex: 1;
    }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="container"&gt;
    &lt;div class="box box-1"&gt;box 1&lt;/div&gt;
    &lt;div class="box box-2"&gt;box 2&lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>