View Full Version : Is there a easy way of CSS styling for a sport league table?

01-13-2004, 08:06 PM
I am making a league table and I know how to style it with 2 different color on each row with CSS: eg light grey on row 1, dark on row 2 and so on... but is there a way using CSS to do it once rather than having to 'class' each row of the league table?


01-13-2004, 08:39 PM
Theoretically, this is how you'd do it:
table tr:nth-child(2n) { background-color: grey }
table tr:nth-child(2n-1) { background-color: aqua }Using CSS3 selectors (http://www.w3.org/TR/css3-selectors/). AFAIK, though, nothing supports this, so you'd have to class everything up. I'd suggest leaving in those selectors though, as they'd do something eventually, and they're not doing any harm.

01-13-2004, 10:34 PM
You could also just use the odd/even keywords. MSN on MacOSX supports use of these keywords (and not the linear equations):

tr:nth-child(even) { }
tr:nth-child(odd) { }

But if you need reasonable support (pretty much nobody uses that browser anyway), you'll have to use classes, Javascript, or a combination of behaviors and bindings.

01-13-2004, 11:23 PM
Oh dear, too much bothering to do that...I got to forget about it and I had another thought - I have decided to use solid bottom black border under each <td> and it looked nice, so it is done using id table once rather than having to class each row. Thanks anyway