Re: [CSS21] Collapsing Margins

On Tue, Sep 9, 2008 at 12:55 PM, Lachlan Hunt wrote:
>
>  There is some confusion internally here at Opera as to whether or not the
> CSS 2.1 correctly deals with the case of collapsing margins where an element
> has height of auto and a min-height greater than the bottom margin edge of
> the element's last, in-flow block-level element. The issue can be
> demonstrated using this test case [1].
>
> (Firefox passes that test, but both Opera and Safari fail because they seem
> to collapse the bottom margin through the parent element)
>
> The confusion seems to be regarding this statement in section 8.3.1
> Collapsing Margins [2]:
[...]
>
> [1] http://lachy.id.au/dev/css/tests/adhoc/collapsing-margins-01.html
> [2] http://www.w3.org/TR/CSS21/box.html#collapsing-margins


There has recently been an accepted change of the wording of the 8.3.1
paragraph that you mention, see [3]. This doesn't change the requested
behavior except in some edge cases. Whichever the formulation of the
spec, in your test case there should be no collapsing, If I understand
well.
Indeed the 'used height' of the element (body)  is affected by the
min-height rule:
 - it is equal to min-height (so there should be no collapsing
according to the current formulation)
 - it is NOT equal to what it would have been if min-height were its
initial value (so there should be no collapsing according to the
accepted change either)

Unless of course you have a very short window (html), less than the
height of the inner div, in which case there should be collapsing.

(Also to note, in your test case even if there would be collapsing,
and indeed even adding a margin-bottom directly to body, Firefox do
not provide scrollbars to "see" this margin bottom. I seem to remember
that something similar has been debated in the past.)


Best regards,
Bruno


[3] http://csswg.inkedblade.net/spec/css2.1#issue-14

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

Received on Tuesday, 9 September 2008 13:57:21 UTC