[CSS21] Does the root element establish a block formatting context? (was: Re: [CSS21] 9.2 Anonymous boxes)

Anton Prowse wrote:
> fantasai wrote:
>> On 08/01/2010 02:45 PM, Anton Prowse wrote:
>>> Issue 5:
>>>
>>> Why would there be an anonymous block box around the BODY? Surely the
>>> principal block box of the (implied[6]) HTML is what surrounds the
>>> anonymous block box around C1, the principal block box of the P, and the
>>> anonymous block box around C2.
>>
>> Good point. Assuming "display: none" for the <head> and "display: block"
>> for <html>, the example here is wrong.
> 
> Yep.  And just to be clear here, had HTML been display:inline, we'd have
> ended up with the three block boxes as the "top level" boxes of the
> canvas, since there's no "initial box" or similar concept, right?
> (There's an initial containing block, but this is a region, not a box.)

Nope, I'm wrong (in CSS21 at least).  Whilst there's no "initial box",
the computed value of 'display' for the root element is either 'table',
'block' or 'list-item' (9.7).  Hence it always generates a principal
box.

Which is a relief, really – because shouldn't the root element establish
a block formatting context?  (It was believed to do so in 2002.[1]) It
doesn't if its specified value is 'inline' or 'run-in', for example (in
which case its computed value of 'display' is 'block').  Indeed, 9.4.1
seems to explicitly exclude the possibility:

   # Floats, absolutely positioned elements, inline-blocks, table-cells,
   # table-captions, and elements with 'overflow' other than 'visible'
   # (except when that value has been propagated to the viewport)
   # establish new block formatting contexts.

But I'm not sure things make much sense without an initial block
formatting context.  (At least, further editorial work seems necessary
in 9.2.1 if there isn't, since, as far as I can currently tell, the
definition of "block-level box" is roughly "a box which participates in
a block formatting context".)

Note that the root element possesses all the characteristic properties
of an element which establishes a BFC, including in relation to margin
collapsing.


[1] http://lists.w3.org/Archives/Public/www-style/2002Nov/0145.html

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

Received on Monday, 9 August 2010 10:32:26 UTC