Re: [CSS2.1] Margin collapse

Staffan Måhlén wrote:

>What is the intention of and examples of the collapse-through definition at 
>http://www.w3.org/TR/CSS21/box.html#collapsing-margins:
>"If the top and bottom margins of a box are adjoining, then it is possible for margins to 
>collapse through it. In this case, the position of the element depends on its relationship 
>with the other elements whose margins are being collapsed.
>
>    * If the element's margins are collapsed with its parent's top margin, the top border 
>edge of the box is defined to be the same as the parent's.
>    * Otherwise, either the element's parent is not taking part in the margin collapsing, or 
>only the parent's bottom margin is involved. The position of the element's top border 
>edge is the same as it would have been if the element had a non-zero top border."
>
>
>I also think that the 8.3.1 section is rather elaborate description of a difficult feature that 
>often confuses authors, which should require at least the following examples:
>
><p>...</p>
><!-- trivial collapse here-->
><p>...</p>
>
><p>...</p>
><!-- tripple-collapse here-->
><blockquote>
>  <p>...</p>
></blockquote>
>
>And possibly an example of the collapse-through feature, depending on what its 
>examples are.
>
> /Staffan
>
>  
>
Your assumptions are correct on the majority of this e-mail.

As far as "Collapse Through It"....think about this....

<p style="margin-bottom: 20px;">Paragraph1</p>
<p class="emptyP" style="line-height: 0px; margin: 40px;"></p>
<p style="margin-top: 25px;">Paragraph2</p>

Where the p with class "emptyP" would have computed height of 
"0"....meaning the margin-boxes would adjoin...thus the actual margin 
would not be 40px, but rather the greater of the two around it, meaning 
Paragraph 2, with 25px;

(yes line-height is sensitive, and in-fact some UA's may even treat 
empty content as needing no line-height quite appropriately).

That is, at least how I understand all talk and use-cases of that 
definition.

~Justin Wood

Received on Thursday, 5 August 2004 16:31:14 UTC