title: CSS: Setting width/height as Percentage minus pixels to a table header column
body: <p>Why in the following example do the columns of the header of the table not take the widths defined in the CSS?</p>
  
  <p>I think in Table 1, the browser can not calculate a percentage value and a fixed one.
  <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>/************* commun css***********************/
  table {
     border-collapse: collapse;
     table-layout:fixed;
     width: 100%;
     position: relative;
  }
  
  td, th {
     border: 1px solid black;
     -webkit-box-sizing: border-box;
  }
  
  tr{
    width: 100%;
    position: relative;
  }
  
  /************* css table 1***********************/
  
  .table1 .col1 {
    width: calc(35% - 10px);
  }
  
  .table1 .col2 {
    width: calc(40% - 10px);
  }
  
  .table1 .col3 {
    width: calc(25% - 10px);
  }
  
  .table1 .col4 {
    width: 30px;
  }
  
  /************* css table 2***********************/
  .table2 .col1 {
    width: calc(30%);
  }
  
  .table2 .col2 {
    width: calc(20%);
  }
  
  .table2 .col3 {
    width: calc(50%);
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;p&gt;
  Table 1 : invalid render (Chrome browser)
  &lt;/p&gt;
  &lt;table class="table1"&gt;
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;th class="col1"&gt;Col 1&lt;/th&gt;
        &lt;th class="col2"&gt;Col 2&lt;/th&gt;
        &lt;th class="col3"&gt;Col 3&lt;/th&gt;
        &lt;th class="col4"&gt;Col 4&lt;/th&gt;
      &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
      &lt;tr&gt;
        &lt;td&gt;Row 1&lt;/td&gt;
        &lt;td&gt;Row 1&lt;/td&gt;
        &lt;td&gt;Row 1&lt;/td&gt;
        &lt;td&gt;Row 1&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;Row 2&lt;/td&gt;
        &lt;td&gt;Row 2&lt;/td&gt;
        &lt;td&gt;Row 2&lt;/td&gt;
        &lt;td&gt;Row 2&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
  
  &lt;p&gt;
  Table 2 : valid render (Chrome browser)
  &lt;/p&gt;
  
  &lt;table class="table2"&gt;
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;th class="col1"&gt;Col 1&lt;/th&gt;
        &lt;th class="col2"&gt;Col 2&lt;/th&gt;
        &lt;th class="col3"&gt;Col 3&lt;/th&gt;
      &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
      &lt;tr&gt;
        &lt;td&gt;Row 1&lt;/td&gt;
        &lt;td&gt;Row 1&lt;/td&gt;
        &lt;td&gt;Row 1&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td&gt;Row 2&lt;/td&gt;
        &lt;td&gt;Row 2&lt;/td&gt;
        &lt;td&gt;Row 2&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Does anyone have any advice in this situation?</p>
  
  <p>Thank you in advance</p>
  
  <p>Example : <a href="https://jsfiddle.net/3wq65hb4/" rel="nofollow noreferrer">https://jsfiddle.net/3wq65hb4/</a></p>