The nth-child CSS pseudo-class represents elements that are among An+Bth elements from the list composed of their inclusive siblings that match the selector list S.
selector:nth-child(An+B [of S]? )
{
property: value;
}
<!doctype html>
<html>
<head>
<style>
table, td
{
border-style: solid;
}
tr:nth-child(2n+1 of .myclass)
{
background-color: yellow;
}
</style>
</head>
<body>
<table>
<tr class="myclass">
<td>of S</td>
<td>of S</td>
<td>of S</td>
<td>of S</td>
</tr>
<tr>
<td>of S</td>
<td>of S</td>
<td>of S</td>
<td>of S</td>
</tr>
<tr>
<td>of S</td>
<td>of S</td>
<td>of S</td>
<td>of S</td>
</tr>
<tr>
<td>of S</td>
<td>of S</td>
<td>of S</td>
<td>of S</td>
</tr>
</table>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
table, td
{
border-style: solid;
}
tr:nth-child(even)
{
background-color: yellow;
}
</style>
</head>
<body>
<table>
<tr>
<td>even</td>
<td>even</td>
<td>even</td>
<td>even</td>
</tr>
<tr>
<td>even</td>
<td>even</td>
<td>even</td>
<td>even</td>
</tr>
<tr>
<td>even</td>
<td>even</td>
<td>even</td>
<td>even</td>
</tr>
<tr>
<td>even</td>
<td>even</td>
<td>even</td>
<td>even</td>
</tr>
</table>
</body>
</html>
<!doctype html>
<html>
<head>
<style>
table, td
{
border-style: solid;
}
tr:nth-child(odd)
{
background-color: yellow;
}
</style>
</head>
<body>
<table>
<tr>
<td>odd</td>
<td>odd</td>
<td>odd</td>
<td>odd</td>
</tr>
<tr>
<td>odd</td>
<td>odd</td>
<td>odd</td>
<td>odd</td>
</tr>
<tr>
<td>odd</td>
<td>odd</td>
<td>odd</td>
<td>odd</td>
</tr>
<tr>
<td>odd</td>
<td>odd</td>
<td>odd</td>
<td>odd</td>
</tr>
</table>
</body>
</html>