I want to color the rows of my table with differents colors so I'm using this
table#news tr:nth-child(even) {
background-color: red;
}
table#news tr:nth-child(odd) {
background-color: green;
}
It works well with this kind of structure
<table id="news">
<tr><td>Row 1</td></tr>
<tr><td>Row 2</td></tr>
<tr><td>Row 3</td></tr>
</table>
But now I work with this kind of table.
<table id="news">
<tr>
<td>
<tr><td>1</td></tr>
<tr><td>2</td></tr>
</td>
</tr>
</table>
The style is also applied for the rows inside the rows.
How can I proceed to apply the alternate color only for the first level of <tr>
?