W3C home > Mailing lists > Public > www-style@w3.org > November 2008

[CSS2.1] table container behavior (captions, floats and margin collapsing)

From: Alex Mogilevsky <alexmog@microsoft.com>
Date: Sun, 23 Nov 2008 23:13:27 -0800
To: "www-style@w3.org" <www-style@w3.org>
Message-ID: <7C2F64B551D8664AAD94A28DAC37D0206B4F779D99@NA-EXMSG-C103.redmond.corp.microsoft.com>
Hi group,

We are trying to figure out proper behavior for the anonymous table container box, defined in CSS2.1 - 17.4 [1]

The spec says

"The anonymous box is a 'block' box if the table is block-level, and an 'inline-block' box if the table is inline-level, except that this block is never considered as a block for 'run-in' interaction, and that the table box (not the anonymous box) is used when doing baseline vertical alignment for an 'inline-table'. The width of the anonymous box is the border-edge width of the table box inside it, as described by section 17.5.2. Percentages on 'width' and 'height' on the table are relative to the anonymous box's containing block, not the anonymous box itself."
Which we understand as saying that this is a regular block (except for run-ins). Therefore it has to allow floats to interact with its content, making it possible for captions to be misaligned with table when floats are involved (or even be detached from table).

Anonymous table box is also special in margin collapsing behavior: table margin is applied to the anonymous box and that margin is collapsed with the outer margin of caption.

IE8 has implemented all of the above. We are discovering however that


*         most browsers support applying table margin the anonymous box (except Firefox)

*         almost no other browser supports collapsing of caption margin with table margin (only Opera collapses bottom margin of bottom caption with bottom table margin; not top)

*         no other browser supports float intrusions into anonymous table box

The difference is significant, and the affected cases will not be hard to run into. Regardless of IE being right or wrong, this will be an issue for web developers.

Hence, we have a few questions here


1)      Is our reading of the spec correct, requiring that the anonymous table box is not a block formatting context and must be transparent for floats?

2)      Is it intentional?

3)      Considering that the box is universally implemented as a block formatting context, should the spec just say so?

We realize that making the box a block formatting context changes both the float behavior and caption margin collapsing. The latter makes some sense (and it is probably OK to keep it), but it also creates a special kind of block which is nearly identical to blocks defined elsewhere with one subtle difference. We are not against keeping the caption margin collapsing but we don't feel it is worth the additional complexity of creating another special case for margin collapsing.

If we decide that the intended behavior really doesn't involve float interaction, we will gladly propose an edit and change IE8 implementation to match the updates spec.

Attached are two test cases and a screen shot with IE8 and Firefox

Test 1: caption margin collapsing
Test 2: caption and float

Thanks in advance for answers and opinions
Alex

[1] http://www.w3.org/TR/CSS21/tables.html#model



table-container.png
(image/png attachment: table-container.png)

Received on Monday, 24 November 2008 07:14:33 GMT

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