Re: Styling table columns--why so limited?

Dan Delaney wrote:
> 
> Could someone please point me to a discussion of the rationale behind 
> such limited style options for the colgroup and col elements? I'd like 
> to know why the spec doesn't allow for something as important as 
> "text-align" and other styles on those elements.
> 
> Thanks
> --Dan

I've been wondering about that for a while as well, but looking at the 
DOM tree it actually makes sense.
The col element itself has semantical meaning, but doesn't actually 
contain any td's or th's. These are contained within a tr.
You can style a tr and the child elements (td/th) will inherit that 
styling. They cannot inherit properties of non-parent elements tho.

A good solution is using th's and the good old "headers" attribute in 
conjunction. Sure, you have to define the headers for every cell, but 
that also makes it more accessible.
In CSS you can use the [attr="value"] selector to style all tds in a 
particular col or row or otheriwse related to a header.

Sadly that won't work in MSIE. There's no way but using classes in IE.

Please also note this is a CSS discussion list, not a support list for 
implementation issues in combination with particular markup languages. 
You're not exactly asking in the right place.

-ap

Received on Wednesday, 31 March 2004 09:11:59 UTC