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

Re: [CSS21] Collapsing Margins

From: Bruno Fassino <fassino@gmail.com>
Date: Tue, 9 Sep 2008 21:41:49 +0200
Message-ID: <da98bce00809091241k5fe9ea2byebb30aee2c8fae56@mail.gmail.com>
To: "Lachlan Hunt" <lachlan.hunt@lachy.id.au>
Cc: www-style <www-style@w3.org>

On Tue, Sep 9, 2008 at 9:08 PM, Lachlan Hunt wrote:
>
> 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.


Indeed, at least according my reading of the spec :-),  only in the
first test case there should be margin collapsing.
In the second one the two margins are not adjoining, and the green box
should not cover the red one (being just after the text). This is what
Firefox does.

-- 
Bruno Fassino http://www.brunildo.org/test
Received on Tuesday, 9 September 2008 19:42:31 GMT

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