title: Table header vertical th text
body: <p>I have some problems with a large table that I want to display different so I have decided to show table header vertically 45deg. All good and fine when I have more registration but when I do a search in table that returned me just one r two registration the table look not nice and easy to use like in this attached picture:</p>
  
  <p><img src="https://i.stack.imgur.com/8pTT0.png" alt="enter image description here"></p>
  
  <p>So my question is how to make that columns to take a dynamic width instead of large left header and small right columns.</p>
  
  <p><strong><a href="http://jsfiddle.net/D2RLR/7565/" rel="nofollow noreferrer">Here is a fiddle with my example :</a></strong></p>
  
  <p><strong>HTML:</strong></p>
  
  <pre><code>&lt;table class="table table-striped table-header-rotated"&gt;
      &lt;thead&gt;
        &lt;tr&gt;
          &lt;!-- First column header is not rotated --&gt;
          &lt;th&gt;&lt;/th&gt;
          &lt;!-- Following headers are rotated --&gt;
          &lt;th class="rotate-45"&gt;&lt;div&gt;&lt;span&gt;Column header 1&lt;/span&gt;&lt;/div&gt;&lt;/th&gt;
          &lt;th class="rotate-45"&gt;&lt;div&gt;&lt;span&gt;Column header 2&lt;/span&gt;&lt;/div&gt;&lt;/th&gt;
          &lt;th class="rotate-45"&gt;&lt;div&gt;&lt;span&gt;Column header 3&lt;/span&gt;&lt;/div&gt;&lt;/th&gt;
        &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
          &lt;th class="row-header"&gt;Row header 1&lt;/th&gt;
          &lt;td&gt;33&lt;/td&gt;
          &lt;td&gt;978&lt;/td&gt;
          &lt;td&gt;57&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th class="row-header"&gt;Row header 2&lt;/th&gt;
          &lt;td&gt;99&lt;/td&gt;
          &lt;td&gt;678&lt;/td&gt;
          &lt;td&gt;67&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;th class="row-header"&gt;Row header 3&lt;/th&gt;
          &lt;td&gt;332&lt;/td&gt;
          &lt;td&gt;701&lt;/td&gt;
          &lt;td&gt;877&lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  </code></pre>
  
  <p><strong>CSS:</strong></p>
  
  <pre><code>.table{width:93%;}
  .table-header-rotated th.row-header{
    width: auto ;
  }
  .table-header-rotated td{
    width: 40px;
    border-top: 1px solid #dddddd;
    border-left: 1px solid #dddddd;
    border-right: 1px solid #dddddd;
    vertical-align: middle;
    text-align: center;
  }
  
  .table-header-rotated th.rotate-45{
    height: 80px;
    position: relative;
    vertical-align: bottom;
    padding: 0;
    font-size: 12px;
    line-height: 0.8;
  }
  
  .table-header-rotated th.rotate-45 &gt; div{
    position: relative;
    top: 0px;
    left: 40px; /* 80 * tan(45) / 2 = 40 where 80 is the height on the cell and 45 is the transform angle*/
    height: 100%;
    transform:skew(-45deg,0deg);
    overflow: hidden;
    border-left: 1px solid #dddddd;
    border-right: 1px solid #dddddd;
    border-top: 1px solid #dddddd;
  }
  
  .table-header-rotated th.rotate-45 span {
    transform:skew(45deg,0deg) rotate(315deg);
    position: absolute;
    bottom: 30px; /* 40 cos(45) = 28 with an additional 2px margin*/
    left: -25px; /*Because it looked good, but there is probably a mathematical link here as well*/
    display: inline-block;
    width: 85px; /* 80 / cos(45) - 40 cos (45) = 85 where 80 is the height of the cell, 40 the width of the cell and 45 the transform angle*/
    text-align: left;
  }
  </code></pre>