Re: [CSS21] Floats, overflow: hidden, BFCs and margins

On 20/02/2012 01:14, "Gérard Talbot" wrote:

> Margins and block formating contexts
> http://www.gtalbot.org/BrowserBugsSection/css21testsuite/marges-contexte-formatage.html
>
> Are the 6 tests in that page correct? The question is important as there
> are diverging implementations. If they are not, please quote the relevant
> excerpts of the spec.

Note that it's not clear what you're testing, specifically, but I'm 
assuming that it's the general issue of BFC margins next to floats.  I 
did some analysis a couple of years back on this; you might want to read 
[1] and its follow-ups.  Bert Bos's intention, as stated in that thread, 
was that this behaviour would be defined more precisely in CSS3.


I see nothing controversial about Tests 3 and 6.  Something based on 
those should form part of the test suite.


The behaviour of Tests 1 and 2 as regards the left margin of the 
non-floated BFC, and Tests 4 and 5 as regards the right margin of the 
non-floated BFC, is undefined in CSS21:

   # The border box of a table, a block-level replaced element, or an
   # element in the normal flow that establishes a new block formatting
   # context (such as an element with 'overflow' other than 'visible')
   # must not overlap the margin box of any floats in the same block
   # formatting context as the element itself.

Note how the spec says nothing about how to handle the float-facing 
margin of the non-floated BFC.

Your conclusion that some browsers are incorrect as regards the *right* 
margin in Tests 1, 2 and 4 looks good to me; there are clearly some 
browser bugs here.  (In Test 5 I believe the "incorrect" behaviour is 
permitted by the spec, but given that the behaviour is not symmetrical 
wrt Test 2 it's probably just coincidence.)


[1] http://lists.w3.org/Archives/Public/www-style/2009Jan/0275.html (the 
thread is disjointed in the archive, so it's best to do an Advanced 
Search for the subject line instead).

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

Received on Monday, 20 February 2012 11:25:29 UTC