Responsive Tables with CSS - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Table Responsive

Description

Responsive Tables with CSS

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">
@media only screen and (max-width: 760px)   {
   thead {<!--from  w w  w . j a v  a2  s .  co  m-->
      display:none;
   }
   
   table {
      border-collapse:collapse;
   }
   
   table, tbody, tr, td {
      display:block;
      width:100%;
   }
   
   tr {
      overflow:hidden;
   }
   
   td {
      padding:0;
   }
   
   td.cell-time, td.cell-pax,
      td.cell-name, td.cell-mobile {
      float:left;
      width:51%;
   }

}
</style> 
 </head> 
 <body> 
  <table> 
   <thead> 
    <tr> 
     <th class="cell-time">Lorem ipsum </th> 
     <th class="cell-pax">Lor</th> 
     <th class="cell-name">Lore</th> 
     <th class="cell-mobile">Lorem </th> 
     <th class="cell-email">Lorem</th> 
    </tr> 
   </thead> 
   <tbody> 
    <tr> 
     <td class="cell-time">Lorem i</td> 
     <td class="cell-pax">L</td> 
     <td class="cell-name">Lorem</td> 
     <td class="cell-mobile">Lorem ipsu</td> 
     <td class="cell-email">Lorem ipsum dolor sit</td> 
    </tr> 
    <tr> 
     <td class="cell-time">Lorem i</td> 
     <td class="cell-pax">L</td> 
     <td class="cell-name">Lore</td> 
     <td class="cell-mobile">Lorem ipsum</td> 
     <td class="cell-email">Lorem ipsum dolor si</td> 
    </tr> 
   </tbody> 
  </table>  
 </body>
</html>

Related Tutorials