+ Start a Discussion

alternating row colors in a table

I need to alternate row colors in a particular way:


The headers is in one color (let's say yellow).


The first, second row (which is actually splitted in two rows at some point) and the third row is in one color (blue)


The fourth, fith (which again splits in two rows at some point) and sixth row should be in a differnet color. (red)


And from here it repeats alternativately. How can I do this? I would appreciate any sample code. Thank you very much!





You can use CSS's nth-child(odd) or nth-child(even) to make even/odd highlights. Of course, there's other ways to do it, like the rowRules attribute as well.

I would like to keep the header with a unique color. Then after the header, the 1st, 2nd, 3rd, and 4th row in one color, and the 5th, 6th,7th,and 8th column in a different color. And so on. Is there a way to do this?