Nested tables - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Table

Description

Nested tables

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<!--  w w w .  j  a  v  a 2  s.  c om-->
 {
   margin-left:21px;
   margin-right:21px;
   border:solid Chartreuse;
   caption-side:bottom;
   border-collapse:collapse;
}

td,th
 {
   padding:6px;
   border:dotted yellow;
}

caption
 {
   font-style:italic;
   padding:9px;
}

.centerone
 {
   text-align:center;
}

.rightone
 {
   text-align:right;
}

th
 {
   background-color:blue;
}

.alternate
 {
   background-color:pink;
}

.nested_table th
 {
   background-color:OrangeRed;
}
</style> 
 </head> 
 <body> 
  <table> 
   <caption>
     Lorem ipsum dolor sit amet, consectetur adipis 
   </caption> 
   <tbody> 
    <tr> 
     <th>Lore</th> 
     <th class="centerone">Lore</th> 
     <th class="centerone">Lore</th> 
     <th class="rightone">Lorem ip</th> 
     <th class="rightone">Lorem ipsu</th> 
     <th class="centerone">Lorem ipsum </th> 
    </tr> 
    <tr> 
     <td>Lorem ipsum dol</td> 
     <td class="centerone">Lorem ips</td> 
     <td class="centerone">Lo</td> 
     <td class="rightone">Lorem ip</td> 
     <td class="rightone">Lorem </td> 
     <td class="centerone">Lor</td> 
    </tr> 
    <tr class="alternate"> 
     <td>Lorem ipsum do</td> 
     <td>Lorem ipsum</td> 
     <td>Lo</td> 
     <td>Lorem ip</td> 
     <td>Lo</td> 
     <td>Lor</td> 
    </tr> 
    <tr> 
     <td rowspan="2">Lorem ipsum dolor sit ame</td> 
     <td>Lorem ipsu</td> 
     <td>Lo</td> 
     <td rowspan="2">Lorem ip</td> 
     <td rowspan="2">Lorem</td> 
     <td>Lor</td> 
    </tr> 
    <tr> 
     <td>Lorem ipsum</td> 
     <td>Lo</td> 
     <td> 
      <table class="nested_table"> 
       <tbody> 
        <tr> 
         <th>Lore</th> 
         <td>Lor</td> 
        </tr> 
        <tr> 
         <th>Lore</th> 
         <td>Lor</td> 
        </tr> 
       </tbody> 
      </table> </td> 
    </tr> 
   </tbody> 
  </table>  
 </body>
</html>

Related Tutorials