W3C home > Mailing lists > Public > www-style@w3.org > October 2003

Re: Collapsing vertical margin through parent. why?

From: <staffan.mahlen@comhem.se>
Date: Thu, 16 Oct 2003 19:23:29 +0200
To: Boris Zbarsky <bzbarsky@MIT.EDU>
Cc: "www-style@w3.org" <www-style@w3.org>
Message-ID: <3F8EF031.3442.627A15@localhost>

On 15 Oct 2003 at 11:54, Boris Zbarsky wrote:
> 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. 

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

I agree that this theory works with trivial markup and for simple 
cases. I am not quite as sure whether the added complexity is worth 
the benefit, and i know i have been bitten by this issue and it is an 
easy misstake to make in more complex designs. I currently think that 
deprecating this feature would be a good thing to do.

A better route would probably be to require the author do explicitly 
remove such excess margins when it does cause problems, or do things 
like with nested lists in the default style sheet if there are know 
cases where the nested margin are known to cause a problem.  

I also think the feature may be to simplistic as it works. If your 
example had a background color on section, the margin of the children 
para should probably not have been collapsed.

 /Staffan
Received on Thursday, 16 October 2003 13:24:38 GMT

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