title: Why is my Grid element's height not being calculated correctly?
body: <p>I'm having trouble with a CSS grid element's height.
  The code I am using is:</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>.gridContainer {
    border: thin solid black;
    background: rgba(255, 0, 0, 0.5);
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    width: 100px;
    height: 100px;
    grid-template-areas: 'windowContentHolder';
  }
  
  .gridItem {
    grid-area: windowContentHolder;
    background: rgba(255, 255, 0, 0.5);
    width: 200%;
    height: 200%;
  }
  
  .content {
    background: rgba(255, 0, 0, 0.5);
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="gridContainer"&gt;
    &lt;div class="gridItem"&gt;
      &lt;div class="content"&gt;hi&lt;br/&gt;hi&lt;br/&gt;hi&lt;br/&gt;hi&lt;br/&gt;hi&lt;br/&gt;hi&lt;br/&gt;hi&lt;br/&gt;hi&lt;br/&gt;hi&lt;br/&gt;hi&lt;br/&gt;hi&lt;br/&gt;hi&lt;br/&gt;hi&lt;br/&gt;hi&lt;br/&gt;hi&lt;br/&gt;hi&lt;br/&gt;hi&lt;br/&gt;hi&lt;br/&gt;hi&lt;br/&gt;hi&lt;br/&gt;hi&lt;br/&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>As you can see the <code>gridItem</code> is set to be <code>height:200%</code> and the expected result is not as intended. It should be twice as high (<code>200px</code>) as the parent (<code>100px</code>), with any extra height being hidden by the scroll bar, instead though the height property doesn't seem to be setting at all.</p>
  
  <p>It's seems like the percentage is considering <strong>the child height</strong> instead of the parent height because if we inspect closely the element we will see that its height is twice the height of the child element.</p>
  
  <p><a href="https://i.stack.imgur.com/38O8c.png" rel="noreferrer"><img src="https://i.stack.imgur.com/38O8c.png" alt="enter image description here"></a></p>
  
  <p>The element with 'hi' is not overflowing as would be expected. Changing the <code>gridContainer</code> to 'block' does work as expected, but not with 'grid': </p>
  
  <p><div class="snippet" data-lang="js" data-hide="true" data-console="true" data-babel="false">
  <div class="snippet-code snippet-currently-hidden">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.gridContainer {
    border: thin solid black;
    background: rgba(255, 0, 0, 0.5);
    display: block;
    width: 100px;
    height: 100px;
  }
  
  .gridItem {
    grid-area: windowContentHolder;
    background: rgba(255, 255, 0, 0.5);
    width: 200%;
    height: 200%;
    overflow: auto;
  }
  
  .content {
    background: rgba(255, 0, 0, 0.5);
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="gridContainer"&gt;
    &lt;div class="gridItem"&gt;
      &lt;div class="content"&gt;hi&lt;br/&gt;hi&lt;br/&gt;hi&lt;br/&gt;hi&lt;br/&gt;hi&lt;br/&gt;hi&lt;br/&gt;hi&lt;br/&gt;hi&lt;br/&gt;hi&lt;br/&gt;hi&lt;br/&gt;hi&lt;br/&gt;hi&lt;br/&gt;hi&lt;br/&gt;hi&lt;br/&gt;hi&lt;br/&gt;hi&lt;br/&gt;hi&lt;br/&gt;hi&lt;br/&gt;hi&lt;br/&gt;hi&lt;br/&gt;hi&lt;br/&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>