Using nth-child in tables tr td - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Table Cell

Description

Using nth-child in tables tr td

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 tr td:nth-child(2) {
   background:Chartreuse;
}
</style> <!--from   www . j  a v  a2s.co  m-->
 </head> 
 <body> 
  <table width="100%" border="1"> 
   <tbody> 
    <tr> 
     <td>&nbsp;</td> 
     <td>L</td> 
     <td>&nbsp;</td> 
    </tr> 
    <tr> 
     <td>&nbsp;</td> 
     <td>L</td> 
     <td>&nbsp;</td> 
    </tr> 
    <tr> 
     <td>&nbsp;</td> 
     <td>L</td> 
     <td>&nbsp;</td> 
    </tr> 
    <tr> 
     <td>&nbsp;</td> 
     <td>L</td> 
     <td>&nbsp;</td> 
    </tr> 
    <tr> 
     <td>&nbsp;</td> 
     <td>L</td> 
     <td>&nbsp;</td> 
    </tr> 
   </tbody> 
  </table>  
 </body>
</html>

Related Tutorials