Changing the alternate table row color using CSS 3

Sheonarayan
Posted by Sheonarayan under CSS 3 category on | Points: 40 | Views : 836
To apply alternate HTML table row style color, we can use CSS3 nth-of-type selector.

 tr:nth-of-type(2n) {
background-color: yellow;
}

tr:nth-of-type(2n + 1) {
background-color: blue;
}


The first class would apply to the even rows and second class would apply to the odd rows of the HTML table.

Thanks

Comments or Responses

Login to post response