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

Re: [CSS21] Fixed table layout and percentages

From: Gérard Talbot <www-style@gtalbot.org>
Date: Mon, 16 Apr 2012 21:39:46 -0400
Message-ID: <3eacf89221ac936d86f26df64c32c147.squirrel@ed-sh-cp3.entirelydigital.com>
To: "Simon Sapin" <simon.sapin@kozea.fr>
Cc: "www-style@w3.org" <www-style@w3.org>

Le Mer 16 novembre 2011 19:14, "Gérard Talbot" a écrit :
> Le Mer 16 novembre 2011 10:07, Simon Sapin a écrit :


>> Then some columns get a width, also from `width` properties. Again, I
>> guess that the containing block of columns and cells is the table box.
> I believe the containing block of columns is that table box.
> Table-cells may not have a containing block... you see:
> "
> CSS 2.1 does not define how the height of table cells and table rows is
> calculated when their height is specified using percentage values.
> "
> section 17.5.3
> http://www.w3.org/TR/CSS21/tables.html#height-layout
> In the non-normative section, we can read:
> "A percentage value for a column width is relative to the table width."
> http://www.w3.org/TR/CSS21/tables.html#auto-table-layout
>> So percentage widths refer to the *tentative width* of the table, since
>> its used width is not known yet.
> If you could provide the url of an example about this...
> I think percentage width of column(s) would require to refer to a non-auto
> table width. And it's possible to have impossible situations
> (circular-dependent logic) here.
> eg.:
> table {width: 200px; table-layout: fixed;}
> col#first-column {width: 60%;}
> col#second-column {width: 75%;}
> leads to a not predictable layout.

I've tested this to be sure.

Opera 11.62 will give a 120px width to the first column and then will give
the remaining available width to the second column: 200px - 120px = 80px.

Firefox 11.0 and Chrome 18.0.1025.162 do something else.

They calculate the ratio for each column and compute in this manner:

First column gets: 200px mult by (60/(60+75)) = 89px

Second column gets: 200px mult by (75/(60+75)) = 111px

I will verify eventually with IE8 and Konqueror 4.8.2; I do not have IE9.

No browser so far did what I feared: give 120px for the first column and
then 150px for second column and then apply the "The width of the table is
then the greater of the value of the 'width' property for the table
element and the sum of the column widths (plus cell spacing or borders)."
and change the width of the table from the 200px declared, specified to
270px (sum of columns width).


>> The remaining space is then divided for columns that do not have a width
>> yet. The remaining space is the tentative width minus everything else.
> Everything else being: table borders and column borders and cell borders
> and border-spacing.

This is not precise: everything else being in the 'border-collapse:
separate' model: table borders and border-spacing. The column borders do
not apply in the 'border-collapse: separate' model. Cell borders are
included in the column width.

CSS 2.1 Test suite RC6, March 23rd 2011

Contributions to CSS 2.1 test suite

Web authors' contributions to CSS 2.1 test suite
Received on Tuesday, 17 April 2012 01:40:23 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:14 UTC