title: How can be done fixed header for a scrollable table which has custom column width?
body: <p>I try to fix the header of a scrollable table which has a custom column width.</p>
  
  <p>When I turn the tbody to block tag, then header columns and body columns do not match each other.</p>
  
  <p>You can see the example from this pen</p>
  
  <p><a href="https://codepen.io/engtuncay/pen/Oqayod" rel="nofollow noreferrer">https://codepen.io/engtuncay/pen/Oqayod</a></p>
  
  <p>Html Part has a div, in this div, there is a table, I defined column size in the col tags.</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>    .tableDiv{
        height:150px;
        overflow-y:scroll;
        padding:10px;
      }
      
      .fixed_header{
         width: 100%;
         table-layout: fixed;
      }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>    &lt;div class="tableDiv"&gt;
      &lt;table class="fixed_header"&gt;
        &lt;thead&gt;
          &lt;colgroup&gt;
            &lt;col style="width:70px"&gt;
            &lt;col style="width:150px"&gt;
            &lt;col&gt;
            &lt;col&gt;
            &lt;col&gt;
          &lt;/colgroup&gt;
          &lt;tr&gt;
            &lt;th&gt;Col 1&lt;/th&gt;
            &lt;th&gt;Col 2&lt;/th&gt;
            &lt;th&gt;Col 3&lt;/th&gt;
            &lt;th&gt;Col 4&lt;/th&gt;
            &lt;th&gt;Col 5&lt;/th&gt;
          &lt;/tr&gt;
        &lt;/thead&gt;
        &lt;tbody&gt;
          &lt;tr&gt;
            &lt;td&gt;row 1-0&lt;/td&gt;
            &lt;td&gt;row 1-1&lt;/td&gt;
            &lt;td&gt;row 1-2&lt;/td&gt;
            &lt;td&gt;row 1-3&lt;/td&gt;
            &lt;td&gt;row 1-4&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
            &lt;td&gt;row 2-0&lt;/td&gt;
            &lt;td&gt;row 2-1&lt;/td&gt;
            &lt;td&gt;row 2-2&lt;/td&gt;
            &lt;td&gt;row 2-3&lt;/td&gt;
            &lt;td&gt;row 2-4&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
            &lt;td&gt;row 3-0&lt;/td&gt;
            &lt;td&gt;row 3-1&lt;/td&gt;
            &lt;td&gt;row 3-2&lt;/td&gt;
            &lt;td&gt;row 3-3&lt;/td&gt;
            &lt;td&gt;row 3-4&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
            &lt;td&gt;row 4-0&lt;/td&gt;
            &lt;td&gt;row 4-1&lt;/td&gt;
            &lt;td&gt;row 4-2&lt;/td&gt;
            &lt;td&gt;row 4-3&lt;/td&gt;
            &lt;td&gt;row 4-4&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
            &lt;td&gt;row 5-0&lt;/td&gt;
            &lt;td&gt;row 5-1&lt;/td&gt;
            &lt;td&gt;row 5-2&lt;/td&gt;
            &lt;td&gt;row 5-3&lt;/td&gt;
            &lt;td&gt;row 5-4&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
            &lt;td&gt;row 6-0&lt;/td&gt;
            &lt;td&gt;row 6-1&lt;/td&gt;
            &lt;td&gt;row 6-2&lt;/td&gt;
            &lt;td&gt;row 6-3&lt;/td&gt;
            &lt;td&gt;row 6-4&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
            &lt;td&gt;row 7-0&lt;/td&gt;
            &lt;td&gt;row 7-1&lt;/td&gt;
            &lt;td&gt;row 7-2&lt;/td&gt;
            &lt;td&gt;row 7-3&lt;/td&gt;
            &lt;td&gt;row 7-4&lt;/td&gt;
          &lt;/tr&gt;
       
        &lt;/tbody&gt;
        &lt;/table&gt;
      &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Thanks</p>