Tuesday, December 26, 2017

Make rows alternate colors now with CSS!

This at least works in Google Chrome:

#summary tr {
   margin: 0;
   padding: 0;
   background-color: #f8f8f8;
}
#summary tr:first-child {
   background-color: #e5e5e5;
}
#summary tr:nth-child(2n+3) {
   background-color: #FFFFFF;
}

 
 

Not only will this make the rows alternate colors in the table, but the header for the table will moreover be a third color.

No comments:

Post a Comment