Previous Message
Next Message

<col> in Mozilla

Sent by Ian Hickson on 2 December 2003 15:03


On Tue, 2 Dec 2003, Aleksandar [WINDOWS-1250] Vaci=E6 wrote:
>>
>> See <http://www.w3.org/TR/CSS21/tables.html#q4>.
>
> This is plain ...(stoped before cursing). Why wouldn't they allow ALL
> text and font-properties for col and colgroup?

How would you implement it?

The colour of text is dependent on the 'color' property of its element.
Unless specified, the 'color' property (basically) defaults to 'inherit',
which means take the value of the parent element.

So for some text in a cell, the colour is determined by the color property
of the cell, which is taken from the <tr>, which is taken from the
<tbody>, which is taken from the <table>, which is taken from the <body>.

How could the <col> get a look-in?

You could say that if a cell has no value set, it should inherit from the
column, but then you run into two problems. The first is that in CSS,
everything is always set. That isn't a huge problem, because you could
always change that slightly to handle this case. It wouldn't be pretty,
but it could be done.

The second problem is rather more fundamental.

What we want to do is compute the value of 'color' on cells from the
appropriate table column.

Here is how CSS works, at a very high level:

   1. Parse the stylesheets and the document.

   2. For each element in the document:
       1. Decide which CSS rules apply.
       2. Perform the CSS cascade.
       3. Perform inheritance of properties.
       4. Perform computations (turn 'em's into 'px's, etc). The
          getComputedStyle() DOM method returns these values.
      At this point, every element has a value for every property
      ('display', 'color', etc).

   3. Lay out the document.

   4. Paint the document.

Now, columns are only columns because their display property is set to
'table-column', and a cell is only a cell because it's display is
'table-cell', and the exact relationship between a cell and a column can
only be calculated when laying out the document, since you have to take
into account what cells span several columns, etc.

So you know which cell is in which column during stage 3, and not earlier.
But the stage where you would work out what the color property of a cell
is step 2! And at this stage, you don't actually know which column applies
to which cell!

Hence why the spec limits the properties that apply.

Note that IE6 actually does apply 'color' on columns to the text in the
column's cells. It can do this despite what I said above because it
doesn't support explicit CSS inheritance (the 'inherit' keyword), it
doesn't support getComputedStyle(), and it doesn't support display:
table-column and the other table display types. In IE, the model is
probably more like:

   1. Parse the stylesheets and the document.

   2. For each element in the document:
       1. If it's a table, map out its structure.
       1. Decide which CSS rules apply.
       2. Perform the CSS cascade.
       3. Perform inheritance of properties, inheriting magically from
          table columns if the column isn't inheriting its style itself.

   3. Lay out the document.

   4. Paint the document.

As you can see, this is rather different from what the specs say. And it
is only possible because the model has been quite radically changed, at
the expense of a number of useful properties.


> Does these people ever try to _design_ a web site?

Yes, I do. (I'm one of the editors of the CSS2.1 spec.) I'm not very good
at it though.


> What if I want to style columns, not rows?

We (the working group) _really_ want to support that. Unfortunately, we
have not, in over 4 years of trying to find a solution, found one (or been
given one) that gets around the problems I've outlined above.

Do you have a solution? I would (seriously) love to hear of a solution.


> W3C really needs reality check sometimes.

That's quite possible. :-)

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

______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Previous Message
Next Message

Message thread:

Possibly related: