title: Flex items not respecting margins and box-sizing: border-box
body: <p>I'm trying to achieve a simple thing that we have in standard CSS.</p>
  
  <p>Let's say that I have a grid system with 3 columns and <code>box-sizing: border-box</code>.</p>
  
  <p>That means that I will fit 3 boxes and with a margin that will shrink the size to fit max 3 boxes.</p>
  
  <p>But when I try to do that with FLEXBOX, it's a pain!!</p>
  
  <p>So if I have div's with <code>flex: 1 1 33.33%;  margin: 10px;</code> I was expecting to have 3 boxes per row... but if I use <code>flex-wrap: wrap</code>, that will not shrink to fit 3 boxes .</p>
  
  <p>Here is a example.. the idea is that the second row would have 3 boxes in a row and fourth box would be in the last row.</p>
  
  <p>Thanks</p>
  
  <p><a href="https://jsfiddle.net/mariohmol/pbkzj984/14/" rel="noreferrer">https://jsfiddle.net/mariohmol/pbkzj984/14/</a></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>.horizontal-layout {
    display: flex;
    flex-direction: row;
    width: 400px;
  }
  
  header&gt;span {
    /* flex: 1 1 100%; */
    /* flex: 1 0 100%; */
    flex: 1 1 33.33%;
    margin: 10px;
  }
  
  header&gt;.button {
    background-color: grey;
  }
  
  header&gt;.app-name {
    background-color: orange;
  }
  
  header#with-border-padding {
    flex-wrap: wrap;
  }
  
  header#with-border-padding&gt;span {
    flex: 1 1 33.33%;
    box-sizing: border-box;
    /* this is not useful at all */
  }
  
  header#with-border-padding&gt;.button {
    border: 1px solid black;
    padding-left: 5px;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>NO flex-wrap: wrap, so it not respects the flex 33% &lt;br/&gt;
  &lt;header class="horizontal-layout"&gt;
    &lt;span class="button"&gt;A&lt;/span&gt;
    &lt;span class="app-name"&gt;B&lt;/span&gt;
    &lt;span class="button"&gt;C&lt;/span&gt;
    &lt;span class="button"&gt;D&lt;/span&gt;
  &lt;/header&gt;
  &lt;br/&gt;&lt;br/&gt; WITH flex-wrap: wrap : I expect to have 3 boxes in first row and D box in a down&lt;br/&gt;
  &lt;header id="with-border-padding" class="horizontal-layout"&gt;
    &lt;span class="button"&gt;A&lt;/span&gt;
    &lt;span class="app-name"&gt;B&lt;/span&gt;
    &lt;span class="button"&gt;C&lt;/span&gt;
    &lt;span class="button"&gt;D&lt;/span&gt;
  &lt;/header&gt;</code></pre>
  </div>
  </div>
  </p>