remove border-spacing gaps from zebra stripes for a table - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Table Border

Description

remove border-spacing gaps from zebra stripes for a table

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 {<!--from   w w w  . j av  a 2  s  . c  o m-->
   border-spacing: 0px;
}
tr:nth-child(even) {
   background-color: #c4d8fd;
}
td{
   padding:0 15px 0 15px;
}


      </style> 
 </head> 
 <body> 
  <table> 
   <tbody> 
    <tr> 
     <th>Food</th> 
     <th>Test</th> 
     <th>Healthy?</th> 
    </tr> 
    <tr> 
     <td>Peach</td> 
     <td>Yes</td> 
     <td>Yes</td> 
    </tr> 
    <tr> 
     <td>Broccoli</td> 
     <td>No</td> 
     <td>Yes</td> 
    </tr> 
    <tr> 
     <td>Steak</td> 
     <td>Yes</td> 
     <td>Sort of</td> 
    </tr> 
    <tr> 
     <td>Donut</td> 
     <td>Yes</td> 
     <td>No</td> 
    </tr> 
   </tbody> 
  </table>  
 </body>
</html>

Related Tutorials