W3C home > Mailing lists > Public > www-style@w3.org > April 2004

RE: Styling table columns--why so limited?

From: <Matthew.van.Eerde@hbinc.com>
Date: Mon, 5 Apr 2004 09:49:02 -0700
Message-ID: <B8B9965E9A4B1948839F37ADCB58E9D58130CA@exchange.hbinc.com>
To: Matthew.van.Eerde@hbinc.com
Cc: www-style@w3.org

> From: Ian Hickson [mailto:ian@hixie.ch]
> On Mon, 5 Apr 2004 Matthew.van.Eerde@hbinc.com wrote:
> >
> > The mythical row="" and column="" attributes for the td tags would need
> > to be calculated in another pass.  But this would allow author
> > column-styling along the lines of
> >
> > #exampletable td[column=~3]
> > {	font-weight: bold;
> > }
> 
> This wouldn't work; it suffers from the same problem as the 
> current model.
> 
> You need to do the cascade before you know what is a table, cell, row,
> etc. With your model, how would you know what is a cell?
> 
> See http://ln.hixie.ch/?start=1070385285&count=1 for details.

Like this (allow me to use your example)
<table>
 <colgroup>
  <col id="a">
  <col id="b">
  <col id="c">
 </colgroup>
 <tr>
  <td id="d">
  <td id="e">
  <td id="f">
 </tr>
 <tr>
  <td id="g" colspan="2">
  <td id="h">
 </tr>
</table>

...and this CSS:

#b { display: none; }
#a { color: purple; }
#c { color: blue; }

...find a way to ensure that d and g end up purple and e ends up blue,
with f and h remaining unstyled.

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 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; }

If there was a cell spanning all three columns it would pick up both the
color: purple and the color: blue stylings
As they both have the same specificity, the color: blue wins as it comes
later in the document
Received on Monday, 5 April 2004 12:49:21 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:28 GMT