title: Layout with 3 columns of different sizes using Flex
body: <p>I have a section of the site that must contain three elements side by side. Each element has a minimum width. If the width of the screen is not sufficient to contain all three elements, those that do not fit, go into a new line.</p>
  
  <p>To build this layout I used <a href="https://css-tricks.com/snippets/css/a-guide-to-flexbox/" rel="noreferrer">Flex</a>. 
  <a href="https://plnkr.co/edit/jAtSd1aCn4Cz6B0VOXa6?p=preview" rel="noreferrer"><strong>Code</strong></a>.</p>
  
  <p>html:</p>
  
  <pre><code>&lt;main id='main'&gt;
      &lt;div id='firstRow' class='row'&gt;
          &lt;div id='col1C' class='col'&gt;col1C title
              &lt;div id='col1Ccon'&gt;col1Ccon content&lt;/div&gt;
          &lt;/div&gt;
          &lt;div id='col2C' class='col'&gt;col2C title
              &lt;div id='col2Ccon'&gt;col2Ccon content&lt;/div&gt;
          &lt;/div&gt;
          &lt;div id='col3C' class='col'&gt;col3C title
              &lt;div id='col3Ccon'&gt;col3Ccon content&lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/main&gt;
  </code></pre>
  
  <p>css:</p>
  
  <pre><code>:root {
      --w1Col: 478px;
      --w2Col: 370px;
      --w3Col: 350px;
      --wSum3: calc(var(--w1Col) + var(--w2Col) + var(--w3Col));
  }
  
  html {
      /*height: 100%;*/
  }
  
  body {
      margin: 0;
      font-size: 9pt;
      font-family: 'Roboto', sans-serif;
      font-weight: 300;
      background-color: whitesmoke;
      height: 100%;
      display: flex;
      flex-direction: column;
  }
  
  /***************************************************************
   * Layout first row
   */
  #main {
      background-color: white;
      /*border: 4px solid red;*/
      color: black;
      height: 100%;
      flex-grow: 1; /* ability for a flex item to grow if necessary */
      flex-shrink: 0; /* ability for a flex item to shrink if necessary */
      flex-basis: auto; /* defines the default size of an element before the remaining space is distributed */
  }
  
  #firstRow {
      background-color: white;
      /*border: 1px solid black;*/
      margin: 10px;
      padding: 10px;
      display: flex;
      flex-direction: row; /* colums layout */
      flex-wrap: wrap; /* wrap in multiple lines if it's necessary */
      /*min-width: var(--wSum3);*/
      /*justify-content: flex-end;  defines the alignment along the main axis */
  }
  
  #firstRow .col {
      /*border: 1px solid black;*/
      flex: 1;
      padding: 5px;
      text-align: center;
  }
  
  #col1C {
      background-color: green;
      width: var(--w1Col);
      min-width: var(--w1Col);
      order: 1; /* column order */
      flex-basis: 40%;/*var(--w1Col);  column width */
      justify-content: flex-end;
  
  }
  #col2C {
      background-color: blue;
      width: var(--w2Col);
      min-width: var(--w2Col);
      order: 2; /* column order */
      flex-basis: 35%; /* var(--w2Col);  column width */
      justify-content: flex-end;
  }
  #col3C {
      background-color:  red;
      width: var(--w3Col);
      min-width: var(--w3Col);
      order: 3; /* column order */
      flex-basis: 25%; /*var(--w3Col);  column width */
      justify-content: flex-end;
  }
  
  #col1Ccon, #col2Ccon, #col3Ccon {
      /*border: 1px solid black;*/
      margin: 0 auto; /* center content */
  }
  
  #col1Ccon {
      width: var(--w1Col);
      background-color: lightgreen;
      height: 200px;
  }
  #col2Ccon {
      width: var(--w2Col);
      background-color: lightblue;
      height: 150px;
  }
  #col3Ccon {
      width: var(--w3Col);
      background-color: salmon;
      height: 200px;
  }
  </code></pre>
  
  <p>The code works but there are some tricks I would like to fix.</p>
  
  <ol>
  <li><p>the 3 columns all have the same width and I would like to be able to choose this width. This is because the first element has a minimum width greater than the other two, so the edge is smaller and aesthetically ugly. See <a href="https://jsfiddle.net/6rys2xe5/4/" rel="noreferrer">the same example</a>, I changed only colors</p></li>
  <li><p>the remaining space now grows on both sides of the <code>col*Ccon</code> containers. Instead I would like to grow only on the left side of <code>col1Ccon</code> and on the right side <code>col3Ccon</code>. I would therefore like the contents of the site (<code>col1Ccon + col2Ccon + col3Ccon</code>) to always remain in the center of the page and what changes are the "border" that grow and decrease.</p></li>
  </ol>
  
  <p>I'm stuck and any suggestions are greatly appreciated. Thanks :)</p>