title: CSS: Refactor grid to a flex layout with different childs
body: <p>I'm currently trying to build a flex layout which should have 3 possible childs:</p>
  
  <p><a href="https://i.stack.imgur.com/l4bfP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/l4bfP.png" alt="enter image description here"></a></p>
  
  <ul>
  <li>If the wrapper has just one button, it should have the full width of the wrapper.</li>
  <li>If the wrapper has two childs, the last one should have a max width of 75px and the first one must fill the available space.</li>
  <li>If the wrapper has at all three childs, the first row should be like at the example before but the last child should be in the next row with 100% width.</li>
  </ul>
  
  <p>I've build this grid layout but I need change it to flex because of the compatibility of some browsers. How can I do this? I've tried a lot but the result is always bad.</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 {
      width: 60%;
      display: grid;
      display: -ms-grid;
      grid-template-columns: 1fr 75px;
      text-align: center;
      position: relative;
      margin-bottom: 20px;
  }
  
  .wrapper div+div {
      margin-left: 6px;
  }
  
  .wrapper div {
      background-color: yellow;
      padding: .6em 1em;
      text-align: center;
  }
  
  .wrapper div.show.single-button {
    grid-column: 1/span 2;
  }
  
  .wrapper div.cancel {
      grid-column: 1/span 2;
      -ms-grid-row: 2;
      -ms-grid-column-span: 2;
      margin-top: 6px;
      margin-left: 0;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="wrapper"&gt;
    &lt;div class="show single-button"&gt;Show&lt;/div&gt;
  &lt;/div&gt;
  
  &lt;div class="wrapper"&gt;
    &lt;div class="show"&gt;Show&lt;/div&gt;
    &lt;div class="invoice"&gt;Invoice&lt;/div&gt;
  &lt;/div&gt;
  
  &lt;div class="wrapper"&gt;
    &lt;div class="show"&gt;Show&lt;/div&gt;
    &lt;div class="invoice"&gt;Invoice&lt;/div&gt;
    &lt;div class="cancel"&gt;Cancel&lt;/div&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>