Re: Collapsing vertical margin through parent. why?

Michael Favia wrote:
> I was wondering if there is any reason that the vertical margins of a
> block level element should collapse through the content block of its
> parent. 

Consider the following markup:

   <para>This is the first paragraph</para>
   <para>This is the second paragraph</para>
   <para>This is the third paragraph</para>
   <para>This is the fourth paragraph</para>

and the CSS:

section { margin: 2em 0 }
para { margin: 1em 0 }

Should the space between the two sections be 2em or 4em?

The idea is that margins serve to separate content and that the biggest 
separation applicable should take effect rather than adding up all the 
separations.  This leads to mostly intuitive results when writing 
documents and marking them up with CSS -- people don't want the spacing 
between their sections depending on the contents of the section, 
typically, unless the contents really need more spacing around them than 
sections already have by default.


Received on Wednesday, 15 October 2003 12:59:42 UTC