title: CSS make flex wrapped elements not exceed their siblings width
body: <p>I'm stuck on problem with stretching flexes.
  I have flexbox div with items. These items can stretch to full width and have min-width property, so that 3-4 elements can fit in large screens, and 1-2 in small.
  I want to make their widths equal, but the problem is that wrapped items are wider if their quantity is less than on top elements.</p>
  
  <p>Attached below my current result and expected behavior. How can I make it?
  <a href="https://i.stack.imgur.com/YWf90.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/YWf90.jpg" alt="enter image description here"></a></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.items {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    width: 100%;
  }
  
  .item {
    min-width: 400px;
    border: 1px solid black;
    margin: 0;
    height: 200px;
    flex-grow: 1;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="items"&gt;
    &lt;div class="item"&gt;1&lt;/div&gt;
    &lt;div class="item"&gt;1&lt;/div&gt;
    &lt;div class="item"&gt;1&lt;/div&gt;
    &lt;div class="item"&gt;1&lt;/div&gt;
    &lt;div class="item"&gt;1&lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Thanks!</p>
  
  <hr>
  
  <p><strong>Update 02.05.2016</strong></p>
  
  <p>Thanks to @vals I came up with percentage width solution for different screen sizes. (But it seems I'm having some tiny problem with 33% width elements, in which 1% empty space is left around them xD)</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.items {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    width: 100%;
    box-sizing: border-box;
    align-items: center;
  }
  
  @media only screen and (max-width: 820px)  {
    .item {
      width: 100%;
    }
  }
  
  @media only screen and (min-width: 821px) and (max-width: 1220px)  {
    .item {
      width: 50%;
    }
  }
  
  @media only screen and (min-width: 1221px) and (max-width: 1620px)  {
    .item {
      width: 33%;
    }
  }
  
  @media only screen and (min-width: 1621px) and (max-width: 2020px)  {
    .item {
      width: 25%;
    }
  }
  
  .item {
    box-sizing: border-box;
    border: 1px solid black;
    margin: 0;
    height: 200px;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="items"&gt;
    &lt;div class="item"&gt;1&lt;/div&gt;
    &lt;div class="item"&gt;1&lt;/div&gt;
    &lt;div class="item"&gt;1&lt;/div&gt;
    &lt;div class="item"&gt;1&lt;/div&gt;
    &lt;div class="item"&gt;1&lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>