Reduce width of a TH with a "transform:rotated" content to avoid wasted space - HTML CSS CSS Animation

HTML CSS examples for CSS Animation:Rotate

Description

Reduce width of a TH with a "transform:rotated" content to avoid wasted space

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">
td, th {
   border:2px solid Chartreuse;
   vertical-align:middle;<!--from   w w w . j  ava2  s  . co  m-->
}

th {
   width:2.7em;
   position:relative;
}

th div {
   -webkit-transform:rotate(-91deg) translate(-51%, 0);
   transform:rotate(-91deg) translate(-51%, 0);
   transform-origin:0 0;
   -webkit-transform-origin:0 0;
   position:absolute;
}
</style> 
 </head> 
 <body> 
  <table> 
   <tbody> 
    <tr> 
     <th rowspan="5"> 
      <div>
        Lorem ips 
      </div> </th> 
     <td>Lore</td> 
    </tr> 
    <tr> 
     <td>Lore</td> 
    </tr> 
    <tr> 
     <td>Lore</td> 
    </tr> 
    <tr> 
     <td>Lore</td> 
    </tr> 
    <tr> 
     <td>Lore</td> 
    </tr> 
   </tbody> 
  </table> 
  <table> 
   <tbody> 
    <tr> 
     <th rowspan="4"> 
      <div>
        Lorem i 
      </div> </th> 
     <td>Lore</td> 
    </tr> 
    <tr> 
     <td>Lore</td> 
    </tr> 
    <tr> 
     <td>Lore</td> 
    </tr> 
    <tr> 
     <td>Lore</td> 
    </tr> 
   </tbody> 
  </table>  
 </body>
</html>

Related Tutorials