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

Re: [CSS21] Collapsing Margins

From: Lachlan Hunt <lachlan.hunt@lachy.id.au>
Date: Tue, 09 Sep 2008 21:08:16 +0200
Message-ID: <48C6C9A0.90107@lachy.id.au>
To: Bruno Fassino <fassino@gmail.com>
Cc: www-style <www-style@w3.org>

Bruno Fassino wrote:
> On Tue, Sep 9, 2008 at 5:16 PM, Lachlan Hunt wrote:
>>>> [1] http://lachy.id.au/dev/css/tests/adhoc/collapsing-margins-01.html
>> OK, but what about this case instead.  Given the same HTML, but using this
>> CSS instead:
>>
>> body { min-height: 50px; margin: 0; padding: 0; }
>> div { height: 20px; margin-bottom: 80px; }
>>
>> In this case, the height of the body would be 50px.  But the height of the
>> div plus it's margin is 100px, so should the margin collapse through the
>> body element by 50px?
> 
> No, I think we are again in a case when 8.3.1 excludes collapsing
> (used height NOT equal to what it would have been if min-height were
> its initial value).

Really?  That seems counter-intuitive.  Compare these 2 test cases:

http://lachy.id.au/dev/css/tests/adhoc/collapsing-margins-02.html
http://lachy.id.au/dev/css/tests/adhoc/collapsing-margins-03.html

The only difference between them is that in the first, the outer div has 
a min-height of 20px (equal to the height of the inner div) and in the 
second, it's 21px.  I expected both to render identically, but if you're 
correct, then the margins should only collapse in the first and the 
second test is invalid.

-- 
Lachlan Hunt - Opera Software
http://lachy.id.au/
http://www.opera.com/
Received on Tuesday, 9 September 2008 19:08:56 GMT

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