Style and select second column in a table - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Table Column

Description

Style and select second column in 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">
td:nth-child(2) {
   background-color:Chartreuse;
}
</style> <!-- w  ww.  j  a  v a  2 s.c  o  m-->
 </head> 
 <body> 
  <table> 
   <tbody> 
    <tr> 
     <td>1.1</td> 
     <td>1.2</td> 
     <td>1.3</td> 
    </tr> 
    <tr> 
     <td>2.1</td> 
     <td>2.2</td> 
     <td>2.3</td> 
    </tr> 
    <tr> 
     <td>3.1</td> 
     <td>3.2</td> 
     <td>3.3</td> 
    </tr> 
   </tbody> 
  </table>  
 </body>
</html>

Related Tutorials