I have a table that has dynamic columns added to it by Javascript. I am looking for a way to alternate the background color of every two columns, such as:
<table>
<tr>
<td>FIRST BGCOLOR</td>
<td>FIRST BGCOLOR</td>
<td>SECOND BGCOLOR</td>
<td>SECOND BGCOLOR</td>
<td>FIRST BGCOLOR</td>
<td>FIRST BGCOLOR</td>
<td>SECOND BGCOLOR</td>
<td>SECOND BGCOLOR</td>
</tr>
</table>
So I know how to do alternate coloring with CSS (:nth-child(odd) etc..), but not how to have TWO columns the same color, then different color for the next two, and so on...
How can this be acheived? Javascript or jQuery solutions are also welcomed as I am using those already in the project, but CSS would be preferrable of course.
Thank you all!