Re: [CSS21] Collapsing Margins

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

-- 
Bruno Fassino http://www.brunildo.org/test

Received on Tuesday, 9 September 2008 15:53:14 UTC