Anybody know of a way to use CSS to make table rows alternate color besides doing something like this?
I don't want to have to hard-code the odd/even stuff. I'd like to find a way to have CSS apply alternating colors at "runtime", maybe with a pseudo-selector or something?
Anybody know of a way to do this?
Code:
<table>
<tr class="odd"> ... </tr>
<tr class="even"> ... </tr>
<tr class="odd"> ... </tr>
</table>
Code:
<!-- fictitious styles -->
<style>
tr:odd { background-color: #white; }
tr:even { background-color: #lightgray; }
</style>