HTML table div alignment across table cells - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Table Cell

Description

HTML table div alignment across table cells

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">
table {<!-- ww w. j  a  v  a  2 s .co m-->
   border:2px outset Chartreuse;
   border-spacing:3px 0;
   padding:3px 0;
   line-height:2.3
}

tbody, tbody tr:first-child {
   margin:3px 0;
   padding:3px 0;
   border-top:2px solid yellow;
}

th, td {
   border-color:blue;
   border-style:inset;
   border-width:0 2px
}

thead th {
   border-top-width:2px
}

tbody tr:first-child th, tbody tr:first-child td {
   border-top-width:2px;
   padding:2em 0;
}

thead th, tbody tr:last-child td {
   border-bottom-width:2px
}

.HeaderValue
 {
   width:100%;
   height:auto;
   max-height:3.5em;
   overflow:hidden;
   padding-top:0.6px;
   padding-bottom:0.6px;
}

.Header
 {
   width:100%;
}
</style> 
 </head> 
 <body> 
  <table> 
   <thead> 
    <tr> 
     <th></th> 
     <th>Lorem</th> 
     <th>Lorem</th> 
    </tr> 
   </thead> 
   <tbody> 
    <tr class="Header"> 
     <th>Lorem ipsum d</th> 
     <td></td> 
     <td></td> 
    </tr> 
    <tr> 
     <td> 
      <div class="HeaderKey">
        Lorem 
      </div> </td> 
     <td> 
      <div class="HeaderValue">
        Lorem ipsum d 
      </div> </td> 
     <td> 
      <div class="HeaderValue">
        Lorem ipsum d 
      </div> </td> 
    </tr> 
    <tr> 
     <td> 
      <div class="HeaderKey">
        Lorem 
      </div> </td> 
     <td> 
      <div class="HeaderValue">
        Lorem ipsum d 
      </div> </td> 
     <td> 
      <div class="HeaderValue">
        Lorem ipsum d 
      </div> </td> 
    </tr> 
    <tr> 
     <td> 
      <div class="HeaderKey">
        Lorem 
      </div> </td> 
     <td> 
      <div class="HeaderValue">
        Lorem ipsum d 
      </div> </td> 
     <td> 
      <div class="HeaderValue">
        Lorem ipsum d 
      </div> </td> 
    </tr> 
   </tbody> 
   <tbody> 
    <!-- Iterating over list of Headers --> 
    <tr class="Header"> 
     <th>Lorem ipsum d</th> 
     <td></td> 
     <td></td> 
    </tr> 
    <tr> 
     <td> 
      <div class="HeaderKey">
        Lorem 
      </div> </td> 
     <td> 
      <div class="HeaderValue">
        Lorem ipsum d 
      </div> </td> 
     <td> 
      <div class="HeaderValue">
        Lorem ipsum d 
      </div> </td> 
    </tr> 
    <tr> 
     <td> 
      <div class="HeaderKey">
        Lorem 
      </div> </td> 
     <td> 
      <div class="HeaderValue">
        Lorem ipsum dolor sit amet, 
      </div> </td> 
     <td> 
      <div class="HeaderValue">
        Lorem ipsum d 
      </div> </td> 
    </tr> 
    <tr> 
     <td> 
      <div class="HeaderKey">
        Lorem 
      </div> </td> 
     <td> 
      <div class="HeaderValue">
        Lorem ipsum d 
      </div> </td> 
     <td> 
      <div class="HeaderValue">
        Lorem ipsum d 
      </div> </td> 
    </tr> 
   </tbody> 
  </table>  
 </body>
</html>

Related Tutorials