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 17:52:35 +0200
Message-ID: <da98bce00809090852m5a9dc615p3803cac0f7835ac1@mail.gmail.com>
To: "Lachlan Hunt" <lachlan.hunt@lachy.id.au>
Cc: www-style <www-style@w3.org>

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).

Indeed according to 10.7 the used height (of the body in this case) is
firstly calculated ignoring min-height. This tentative value is 20px
(the margin bottom of the child collapses in this step).  Then
min-height must be applied, and things recomputed using "the value of
min-height as the computed value for height", giving as final value
for the used height 50px. In this step children are ignored, since it
is like we had a computed height for the parent.  It is like the
bottom margin of the child simply overflow the parent (but margins are
not adjoining, so do not collapse).


Bruno Fassino http://www.brunildo.org/test
Received on Tuesday, 9 September 2008 15:53:14 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:27:39 UTC