title: Responsive layout with 3 items per row on larger screens and 1 item per row on smaller screens
body: <p>I want to position 3 items of equal width in a single row on larger screens, stretching items to fill the available space.</p>
  <p><a href="https://i.stack.imgur.com/QRrpD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QRrpD.png" alt="Layout with 3 items in a single row" /></a></p>
  <p>However when the items are less than 200px wide I want to display them all in single column.</p>
  <p><a href="https://i.stack.imgur.com/gUgXS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gUgXS.png" alt="Layout with 3 items stacked on top of one another" /></a></p>
  <p><strong>I never want to have 2 items per row.</strong> Any plain CSS solution such as CSS flexbox or CSS grid is acceptable.</p>
  <p>The following code is incorrect because it will sometimes show 2 items per row.</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>.item {
    height: 200px;
    background-color: blue;
  }
  
  .container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    grid-gap: 1rem;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="container"&gt;
    &lt;div class="item"&gt;&lt;/div&gt;
    &lt;div class="item"&gt;&lt;/div&gt;
    &lt;div class="item"&gt;&lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>