W3C home > Mailing lists > Public > www-style@w3.org > December 2014

Re: [css2] Fixed table layout: width distribution between non-auto columns

From: L. David Baron <dbaron@dbaron.org>
Date: Wed, 10 Dec 2014 09:37:16 -0800
To: Simon Sapin <simon.sapin@exyr.org>
Cc: www-style list <www-style@w3.org>
Message-ID: <20141210173716.GA25917@crum.dbaron.org>
On Thursday 2014-11-27 17:30 +0000, Simon Sapin wrote:
> In http://dev.w3.org/csswg/css2/tables.html#fixed-table-layout
> >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). If the table is wider than the
> >columns, the extra space should be distributed over the columns.
> 
> This does not say *how* the space is distributed. I assumed it was
> equally, but Firefox, Chromium, Safari and IE seem to have interop
> to make it proportional to the widths of the columns β€œso far”.

For what it's worth, the Gecko behavior for handling unassigned
extra space from the table width in table-layout:fixed is:

 1. if some columns do not have specified width, distribute it
    equally among them

 2. otherwise, if some columns have non-zero <length> widths,
    distribute the excess width to them, proportionally to the
    widths

 3. otherwise, if some columns have non-zero <percentage> widths,
    distribute the excess width to them, proportionally to the
    widths

 4. otherwise, distribute the excess width equally to the zero-width
    columns

The code for this is reasonably readable, I think (since it's
basically in one place):
https://hg.mozilla.org/mozilla-central/file/be1f49e80d2d/layout/tables/FixedTableLayoutStrategy.cpp#l331

-David

-- 
π„ž   L. David Baron                         http://dbaron.org/   𝄂
𝄒   Mozilla                          https://www.mozilla.org/   𝄂
             Before I built a wall I'd ask to know
             What I was walling in or walling out,
             And to whom I was like to give offense.
               - Robert Frost, Mending Wall (1914)

Received on Wednesday, 10 December 2014 17:37:47 UTC

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