$(document).ready(function()_x000D_
{_x000D_
$("tr:odd").css({_x000D_
"background-color":"#000",_x000D_
"color":"#fff"});_x000D_
});
_x000D_
tbody td{_x000D_
padding: 30px;_x000D_
}_x000D_
_x000D_
tbody tr:nth-child(odd){_x000D_
background-color: #4C8BF5;_x000D_
color: #fff;_x000D_
}
_x000D_
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>_x000D_
<table border="1">_x000D_
<tbody>_x000D_
<tr>_x000D_
<td>1</td>_x000D_
<td>2</td>_x000D_
<td>3</td>_x000D_
<td>4</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>5</td>_x000D_
<td>6</td>_x000D_
<td>7</td>_x000D_
<td>8</td>_x000D_
</tr>_x000D_
<tr>_x000D_
<td>9</td>_x000D_
<td>10</td>_x000D_
<td>11</td>_x000D_
<td>13</td>_x000D_
</tr>_x000D_
</tbody>_x000D_
</table>
_x000D_
There is a CSS selector, really a pseudo-selector, called nth-child. In pure CSS you can do the following:
tr:nth-child(even) {
background-color: #000000;
}
Note: No support in IE 8.
Or, if you have jQuery:
$(document).ready(function()
{
$("tr:even").css("background-color", "#000000");
});