Re: Table height for absolutely positioned tables in face of table rows with 100% height

On 04/10/2011 06:58, Ehsan Akhgari wrote:
> Hello All,
>
> I'm trying to figure out how this test case is supposed to behave:
>
> https://bugzilla.mozilla.org/attachment.cgi?id=564421
>
> CSS 2.1 10.6.4 seems to suggest that the used height of the table should be that of its containing block, which seems to be what Opera does (and what Gecko used to do until recently).
>
> However, CSS 2.1 17.5.3 seems to suggest that the height of table in this test case is undefined: "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."
>
> WebKit, IE, and as of recent trunk builds, Gecko seem to think that in this case, the height of the table does not depend on the height of the Initial Containing Block.
>
> I think that these two sections are contradictory.
>

Hi Ehsan,

Bear in mind that tables are a little more complex than typical elements 
in CSS.  An HTML table element generates an anonymous block box (that 
is, a block-level block container box) called a "table wrapper box", 
which contains none or more block boxes for the table caption(s) and 
which contains a block-level "table box" that itself contains table rows 
for example.

17.4 says that the computed values of the 'position' property on a table 
element is used on the table wrapper box and not the table box; hence 
it's the table wrapper box that's absolutely positioned in your test case.

10.6.4 tells us that the height of the table wrapper box is equal to the 
height of its containing block, which in your test case is established 
by the content area of the body element (which is exactly or almost the 
height of the viewport in typical UAs for your test case).

However, 17.5.3 says that the height of the table box is given by the 
'height' property of the 'table' element; in your case, the value is 
'auto' which means that the height "is the sum of the row heights plus 
any cell spacing or borders".

17.5.3 goes on to make it clear that the layout is undefined for your 
test case since your table cell has a percentage height.

The height of the fixed-position table wrapper box thus turns out to be 
irrelevant to the height of the table box.  The latter is undefined, and 
there's no contradiction in the spec as regards your test case.

Cheers,
Anton Prowse
http://dev.moonhenge.net

Received on Monday, 12 December 2011 16:58:28 UTC