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

Re: [CSS21] Collapsing Margins

From: Bruno Fassino <fassino@gmail.com>
Date: Wed, 10 Sep 2008 11:39:07 +0200
Message-ID: <da98bce00809100239t7ba1a59fl44d5d2d513351bab@mail.gmail.com>
To: "Alex Mogilevsky" <alexmog@microsoft.com>
Cc: "Arron Eicholz" <Arron.Eicholz@microsoft.com>, www-style <www-style@w3.org>

On Wed, Sep 10, 2008 at 10:39 AM, Alex Mogilevsky wrote:
> 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.
>


Well, I believe I followed your reasoning, I'm still not sure to fully agree.

When 10.6.3 is firstly applied to compute the "tentative height"  this
must be done "without min-height", so collapsing should be tentatively
assumed, and tentative height should be 20px. Third bullet at 10.7
applies and 'used' height goes at 21px (the min-height).

However, I agree with you that  re-reading 10.6.3 independently on
this 10.7 cycle,  the result of 21px doesn't look correct, so I've no
more strong opinion about this.
Things would look more consistent if 10.6.3 mentioned only bottom
padding and border (like it does for the 'top' case)  as cause of
content ending at bottom margin edge of the bottommost child.   Or if
10.6.3 mentioned explicitly that it only lives in the context of the
sequence described at 10.7...


Bruno


-- 
Bruno Fassino http://www.brunildo.org/test
Received on Wednesday, 10 September 2008 09:39:43 GMT

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