Re: Collapsing vertical margin through parent. why?

On 16 Oct 2003 at 13:00, Boris Zbarsky wrote:
> > 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.
> Why not?  The text will have the proper background, as desired.  If the 
> intent is that the section should have a strip of background around its 
> contents, padding on the section should be used.  If there is no such 
> intent, then why should the margin not collapse?

You are probably right, but to me it is counterintuitive that a 
nested margin collapses with the parent. The reason for collapsing 
the nested margins is in my mind only valid if the parent block does 
not have a visible area in the page. 

For example:
div {background-color: #eee}

That the distance between the three headings should be equivalent is 
not obviously the right thing in my mind. That the first and second 
headings push against the edge of the grey area seems quite wrong to 
me. I don't feel all that strongly about this, but doing a quick 
search on CSS-discuss indicates this feature is a reasonably common 
issue for authors.

Glancing briefly at the suggested default style sheet it seems to me 
that the number of occations the feature is used in valid html is 
limited, which could perhaps explain why i don't see much benefit. 
There is blockquote, form and fieldset i think? Is the feature 
employed more in regular tag-soup? Or is the intention to help the 
author who actually writes CSS to get his layout right?

I do agree with your first comment about making simple things simple 
and recognize i may be off the mark here. 

Received on Thursday, 16 October 2003 16:12:37 UTC