Re: [CSS21] Collapsing Margins

Alex Mogilevsky wrote:
> What I mean to say there is that the meaning of margin is to define the distance between elements.

More precisely, the meaning of margin is to define a spacing around a 
given element.

> Consider this:
>         <C>
>                 <A/>
>         </C>
>         <B/>
> 
> If element A has bottom margin of 80px, it would normally mean that it will be at least that far from element B that follows. That may change A has a parent C with certain properties. Specified 'height' on C clearly can reduce this distance, as can 'max-height'. However having 'min-height' reduce overall size of layout seems odd.

Yeah.  That's just life with collapsing margins.  Say you have:

   Text
   <div>
     <div style="height: 20px; margin-bottom: 80px"></div>
   <div>
   More text

There are 80px of space between the two pieces of text, but if the 
height of the outer div is set to 21px (which is bigger than its used 
height!), there will be 21px of space between the two pieces of text.

The min-height case is no different from this, basically.

Now you can claim that really collapsing margins just don't work that 
well once you're not doing auto heights, and that's true, in my opinion. 
  that's not the use case they were designed for.

-Boris

Received on Wednesday, 10 September 2008 19:12:32 UTC