Forum Moderators: open
I have some long tabular data -- 14 columns and many hundreds of rows. So I'll break it into several tables.
In order to make it easy to reference specific information I want to color code the background for 9 very narrow columns - they just contain an "X" or a non-breaking space.
All I can figure is that I need 9 classes, and then apply those classes in every single row -yeccch! Isn't there a more efficient way to do this?
<edit>
I just tested this. Sadly, Mozilla and Opera both fall down on this point, not applying background styles to cols or colgroups. And IE will (incorrectly) destroy the style set by these elements if you explicitly set a transparent background for table cells. So it looks like you are limited to styling the tds individually.
Mcookie - if I could depend on ALL the rows to be just 1 line, this might work well. But the other rows have indefinite amounts of information, so things could get skewed depending on the screen resolution.
moonbiter - yes, I've been testing colgroup and col ever since the W3C created the recommendation - but browser support is SOOO bad, as you've discovered.
zazen - I get what you're saying and it would help a bit. However, this is a consumer site, and I have such a nice 9 color palette to use that I just can't pass it up.
There is an interesting little hack, and it actually takes advantage of W3C specs: namely, that browsers should not create extra rows if a rowspan would extend a column past the end of a table.
In other words, if you specify a rowspan of 100 for one cell, but only actually define 10 rows, the browser is not to create an extra 90 rows.
So you can define your vertical dividers to have a rowspan at least equal to the maximum number of rows you expect to have in your table and know that they will always be exactly the right height.
<edit>
Okay, that's not what you want -- I've just re-read your original post. But it's a useful trick, anyway. :)
</edit>