Previous Message
Next Message

gap between divs

Sent by Michael Landis on 10 November 2003 23:11


Christy asked:

> I am getting a gap between my header div and my content div on Safari
> and Netscape, but not IE (all Mac).

Shaun replied:

> Setting the top margin of your h2.title to 0 will do the trick. I've
> noticed this behavior before with <p> tags. Anyone know why margin-top
> extends outside of the containing element in modern browsers? Is that
> what the spec actually calls for?

Strangely enough, yes! It's called "collapsing margins" and is discussed in
mind-numbing detail at
http://www.w3.org/TR/REC-CSS2/box.html#collapsing-margins . The basic idea
is that if two items have vertical margins that can overlap, they will, if
neither element has a border or padding on that edge. There's a lot more to
it (such as what happens with different positioning models, floating,
nested elements, etc.) but that's the basic concept.

MikeL

______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Previous Message
Next Message

Message thread:

Possibly related: