RE: Styling table columns--why so limited?

> From: Ian Hickson [mailto:ian@hixie.ch]
> On Mon, 5 Apr 2004 Matthew.van.Eerde@hbinc.com wrote:
> >
> > And the CSS as such:
> > /* either */
> > #ian td[column=~2] { display: none; }
> 
> But that doesn't make sense: How can a td be in a column, if 
> it isn't a
> table-cell?

Because it has a column="2" attribute.  Once display: none is applied, it
becomes a non-entity, but it still inherits all the stylings of its classes.
There is a first interpretive pass which is CSS-blind to apply row= and
column= attributes to <td>s regardless of other stylings.  Only then is
there a second CSS pass to apply stylings to cells based on their column=
and row= attributes.

As you observe above, the second pass may very well knock certain cells out
of the sky.  That's fine.  The next cell remains in column three, though -
it doesn't slide to the left to fill the vacated space.  Once column="3" is
applied, the second pass is powerless to change it.  DOM can change it (at
your own risk) via something like td.column++;

> If you have:
> 
>    <a>
>     <b/>
>     <c/>
>     <b/>
>    </a>
> 
> ...and:
> 
>    a { display: table; }
>    b { display: table-cell; }
>    c { display: block; }
> 
> ...then there are three columns (according to CSS2). But you can't know
> this when you do the cascade, you only know it _after_ you have done the
> cascade. So then:
> 
>    b[column=3] { color: blue; }
> 
> ...could never be matched, since you need to know that _before_ the
cascade.

Yes, indeed.  Pure CSS, as a tree-only model, allows for only row-level
stylings.  (Or presumably only column-level stylings.)  This is because you
are thinking of rows and columns as container objects.  If you want to allow
simultaneous row- and column-level stylings, you can NOT think of rows and
columns as objects - you HAVE to think of them as attributes.

Actually that's not entirely true.  If you allow for a notion of sym-links,
you can get away with thinking of rows and columns as objects.  But I don't
propose that because that begins to get kind of silly-complicated.

> -- 
> Ian Hickson                                      
> )\._.,--....,'``.    fL
> U+1047E                                         /,   _.. \   
> _\  ;`._ ,.
> http://index.hixie.ch/                         
> `._.-(,_..'--(,_..'`-.;.'
> 

Received on Monday, 5 April 2004 13:21:25 UTC