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

RE: [CSS21] Collapsing Margins

From: Alex Mogilevsky <alexmog@microsoft.com>
Date: Wed, 10 Sep 2008 01:39:42 -0700
To: Bruno Fassino <fassino@gmail.com>
CC: Arron Eicholz <Arron.Eicholz@microsoft.com>, www-style <www-style@w3.org>
Message-ID: <7C2F64B551D8664AAD94A28DAC37D020632BA4B9E3@NA-EXMSG-C103.redmond.corp.microsoft.com>

Interesting...

In 10.7, if "tentative height" is not smaller than "min-height", then the third bullet doesn't apply.

There are two possible values for "tentative height" of "outer"
1) 20px - if bottom margin of "inner" collapses with "outer"
2) 100px - if bottom margin of "inner" doesn't collapse with "outer"

It may seem that there is a chicken-and-egg problem between determining effect of min-height and deciding to collapse the bottom margins. I don't think it is ambiguous though. The new language for condition in 8.3.1 actually makes it more clear:

        The bottom margin of an in-flow block-level element is adjoining
        to its last in-flow block-level child's bottom margin when:
        * the element's specified 'height' is 'auto',
        * THE ELEMENT'S USED HEIGHT IS THE SAME AS IT WOULD HAVE BEEN IF
        THE SPECIFIED VALUES OF 'MIN-HEIGHT' AND 'MAX-HEIGHT' WERE THEIR
        INITIAL VALUES
        * the element has no bottom padding or border

Calculating the height of "outer":

* If min-height were not set, the height of "inner" and "outer" were 20px.
* Since 20px is less than the value of min-height, bottom margin of "inner" doesn't collapse with "outer"
* According to 10.6.3, "if the bottom margin of the block does not collapse with the bottom margin of its last in-flow child, then the content ends at the bottom margin edge of the bottommost child", meaning that calculated height of "outer" includes bottom margin of "inner" and becomes 100px.

The result of 100px satisfies all restrictions, including content height and min-height. It follows margin collapsing rules properly.

The result of 21px ignores the 80px margin, which is in conflict with 10.6.3, since the other rules (regardless of order of application) determine that the bottom margins don't collapse.

-----Original Message-----
From: Bruno Fassino [mailto:fassino@gmail.com]
Sent: Wednesday, September 10, 2008 12:20 AM
To: Alex Mogilevsky
Cc: Arron Eicholz; www-style
Subject: Re: [CSS21] Collapsing Margins

The point where I'm not sure to agree is:

> * Since "inner" bottom margin doesn't collapse with the parent, it contributes to the height of the parent


If I follow the specs at 10.7 to determine the height of the parent
("outer"), I don't see that the bottom margin of the child ("inner")
should contribute to the height of the parent. Rather it should simply
be ignored (as Firefox does).
Indeed the specs at 10.7 say (3rd point at the end) that when
'min-height' is in effect, the rules for height computing must be
applied again with the value of min-height as the computed value for
height, so as if height were no more 'auto', so ignoring children.
If this reading is correct, then IE8 is not.


--
Bruno Fassino http://www.brunildo.org/test
Received on Wednesday, 10 September 2008 08:40:31 GMT

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