W3C home > Mailing lists > Public > www-style@w3.org > August 2004

Re: [CSS2.1] Margin collapse

From: Ian Hickson <ian@hixie.ch>
Date: Mon, 23 Aug 2004 13:39:27 +0000 (UTC)
To: Staffan Måhlén <staffan.mahlen@comhem.se>
Cc: www-style@w3.org
Message-ID: <Pine.LNX.4.61.0408231337480.812@dhalsim.dreamhost.com>
On Thu, 5 Aug 2004, [ISO-8859-1] Staffan Mhln 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."

An example of an element that has both top and bottom margins that 
collapse together would be the <div> in this example:

   div, p { margin: 1em; }

   <p>Test</p>
   <div></div> <!-- four margins collapse here -->
   <p>Test</p>


> 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.

Examples would be helpful, it's true.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Monday, 23 August 2004 13:39:28 GMT

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