Changing the alternate table row color using CSS 3

Posted by Sheonarayan under CSS 3 category on | Points: 40 | Views : 782
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.


Comments or Responses

Login to post response