Zebrar uma tabela, adicionando uma classe de CSS
Código:
<script type="text/javascript">
$(function(){
$('tbody tr:odd').addClass('odd');
});
</script>
<style type="text/css">
thead th {
background: #f90;
}
.odd {
background: #ffb;
}
</style>
<table>
<thead>
<tr>
<th>Band</th>
<th>Album</th>
</tr>
</thead>
<tbody>
<tr>
<td>NOFX</td>
<td>So long, and thanks for all the shoes</td>
</tr>
<tr>
<td>Millencolin</td>
<td>Life on a plate</td>
</tr>
<tr>
<td>Pennywise</td>
<td>About time</td>
</tr>
</tbody>
</table>
Resultado:
Band |
Album |
NOFX |
So long, and thanks for all the shoes |
Millencolin |
Life on a plate |
Pennywise |
About time |