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:27:06 -0700
Message-ID: <B8B9965E9A4B1948839F37ADCB58E9D58130C9@exchange.hbinc.com>
To: www-style@w3.org

> From: Ian Hickson [mailto:ian@hixie.ch]
> 
> On Wed, 31 Mar 2004, Dan Delaney wrote:
> >
> > I guess what it boils down to for me is this: in practical 
> terms, Web
> > designers need to be able to use, on COL and COLGROUP, all 
> the styles
> > they can use on TDs.
> 
> The working group agrees; unfortunately no-one has yet suggested a
> practical solution to this problem. As I describe in:
> 
>    http://bugzilla.mozilla.org/show_bug.cgi?id=239130
> 
> ...it is a problem with the entire way CSS works. I have yet to see a
> workable solution (though many people have tried, over the years, to
> develop solutions).
> 
> So, please propose a solution!

The solution follows naturally from a low-level definition of the problem.
HTML, XML, SGML etc. are all *trees* - that is, nodes have exactly one
parent.
Tables are *matrices* - that is, cells are members of both a row and a
column.

Thus, the notion of membership is at odds with the notion of inheritance.
Some will say that cells are descended from the row, and some that the cells
are descended from the column.  Can any man serve two masters - and be
faithful to both?

However, we can all agree that cells are members of the table.  In the
current HTML spec this is a grandfather relationship.

So the row and column are fighting over the cell.  Only the table has a
universally accepted claim.

I propose therefore that we grant custody of the cell directly to the table.
Rows - and columns - are no longer objects in and of themselves.  The
historical purposes of row "objects" and column "objects" are in fact for
layout purposes only.  Row-ness and column-ness are in fact merely
attributes - attributes of the cells for positioning, and attributes of the
table for sizing.

To avoid confusion I will create tags with different names.

<grid rows="25" columns="3">
...
</grid>
The ... can consist of various
<cell row="4" column="2">
elements.  In the main, the row and column attributes will serve as
Cartesian coordinates to pinpoint the location of the cell in the grid.

Cells that span multiple rows and columns are an undeniable need.  This can
be served by allowing multivalued row and column attributes - the values
should be separated by spaces
<cell row="25" column="1 2 3">
The space separation allows for CSS selection of individual columns.  This
works nicely with cells that span multiple columns.
If there is a style on column 1 (say, font-weight: bold) and a style on
column 2 (say, color: blue), then the cell listed above will have bold blue
content.

Although I used tags with different names, I see no reason why this same
model could not be applied to standard <table> and <td> tags.  (<tr> would
have meaning as a container.  <col> would be ignored.)  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;
}
Received on Monday, 5 April 2004 12:27:19 GMT

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