title: CSS grid: wrap three divs simultaneously
body: <p>With CSS grid, how can I style three divs to wrap at the same time when the screen gets smaller ?</p>
  
  <p>That means to go from this:</p>
  
  <pre><code>+---------+--+---------+--+---------+
  |   div   |  |   div   |  |   div   |
  +---------+--+---------+--+---------+
  </code></pre>
  
  <p>to this:</p>
  
  <pre><code>+-----+
  | div |
  +-----+
  |     |
  +-----+
  | div |
  +-----+
  |     |
  +-----+
  | div |
  +-----+
  </code></pre>
  
  <p>without first going through this intermediary step:</p>
  
  <pre><code>+---------+--+---------+
  |   div   |  |   div   |
  +---------+--+---------+
  |         |  |         |
  +---------+--+---------+
  |   div   |  |         |
  +---------+--+---------+
  </code></pre>
  
  <p>With that starter code:</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>.wrapper {
    display: grid;
    grid-gap: 10px;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="wrapper"&gt;
    &lt;div class="box"&gt;box 1&lt;/div&gt;
    &lt;div class="box"&gt;box 2&lt;/div&gt;
    &lt;div class="box"&gt;box 3&lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p><a href="https://jsfiddle.net/jLz0aqmj/1/" rel="nofollow noreferrer">https://jsfiddle.net/jLz0aqmj/1/</a></p>