Re: Styling table columns--why so limited?

Matthew.van.Eerde@hbinc.com / 2004-04-05 19:49:
>>From: Ian Hickson [mailto:ian@hixie.ch]
> 
> Like this (allow me to use your example)
> <table>
>  <colgroup>
>   <col id="a">
>   <col id="b">
>   <col id="c">
>  </colgroup>
> [...]
> 
> My model transforms the table as such:
> <table id="ian">
> <!-- the following stuff is irrelevant
>  <colgroup>
>   <col id="a">
>   <col id="b">
>   <col id="c">
>  </colgroup>
> -->
>  <tr>
>   <td id="d" row="1" column="1">
>   <td id="e" row="1" column="2">
>   <td id="f" row="1" column="3">
>  </tr>
>  <tr>
> <!-- colspan on this element corresponds to multivalued column -->
>   <td id="g" colspan="2" row="2" column="1 2">
>   <td id="h" row="2" column="3">
>  </tr>
> </table>

And which part of the CSS cascade does the transform? Based on what 
information? The proposed solution should be usable with generic XML 
documents (among others), too. So, it cannot be (X)HTML parser 
before attaching style sheet to the document tree.

> And the CSS as such:
> /* either */
> #ian td[column=~2] { display: none; }
> /* or */
> #ian td[column=2] { display: none; }
> /* depending on whether multi-column cells are to be styled as well
>    for display: none; probably the latter
> */
> 
> #ian td[column=~1] { color: purple; }
> #ian td[column=~3] { color: blue; }

I must admit that this style would be quite readable. It still 
suffers from the problem that it doesn't inherit properties from 
columns. Instead, it's just a way to construct a selector to somehow 
select the cells we're supposedly interested in. Still we have to 
compute the column number instead of using the #id of the column 
we're really interested in.

-- 
Mikko

Received on Tuesday, 6 April 2004 10:05:01 UTC