title: How do I specify row heights in CSS Grid layout?
body: <p>I have a CSS Grid Layout in which I want to make <strong>some</strong> (middle 3) rows stretch to their maximum size. I'm probably looking for a property similar to what <code>flex-grow: 1</code> does with Flexbox but I can't seem to find a solution.</p>
  
  <blockquote>
    <p>Note: This is intended for an <a href="http://electron.atom.io/" rel="noreferrer">Electron</a> app only, so browser compatibility is not really a concern.</p>
  </blockquote>
  
  <p>I have the following CSS Grid Layout:</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>.grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr 1fr;
    grid-gap: 10px;
    height: calc(100vh - 10px);
  }
  
  .grid .box {
    background-color: grey;
  }
  
  .grid .box:first-child,
  .grid .box:last-child {
    grid-column-start: 1;
    grid-column-end: -1;
  }
  
  /* These rows should 'grow' to the max height available. */
  .grid .box:nth-child(n+5):nth-child(-n+7) {
    grid-column-start: 1;
    grid-column-end: -1;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="grid"&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 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 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;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Which creates the following grid:</p>
  
  <p><a href="https://i.stack.imgur.com/asSZw.png" rel="noreferrer"><img src="https://i.stack.imgur.com/asSZw.png" alt="Current Grid"></a></p>
  
  <p><br /><br /><br />
  When none of the boxes contain any content I would like the grid to look something like this:</p>
  
  <p><a href="https://i.stack.imgur.com/iLhJE.png" rel="noreferrer"><img src="https://i.stack.imgur.com/iLhJE.png" alt="Preferred Grid"></a></p>