W3C home > Mailing lists > Public > www-style@w3.org > September 2002

Margin collapsing and floats

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Fri, 13 Sep 2002 19:06:29 -0400
Message-Id: <200209132306.TAA05009@nerd-xing.mit.edu>
To: www-style@w3.org

I have a question about margin collapsing and floats.  Currently the
CSS2.1 specification says:

* Vertical margins between a floated box and any other box do not

Is this really the intent?  If I have:

<div style="float: right; border: 1px solid black">
  <div style="margin: 1em">Some text</div>

Should the border really be 1em from the text of the inner div (unlike
the non-floated case, when it would be next to the text in the inner

Consider using a <p> (which has default margins in most browsers) inside
a border-less floater that has a margin because you don't want the text
flowing around it.  In this case one would think margin-collapsing would
be desirable, no?

It seems that what's really meant here is that floated boxes' margins do
not collapse except with descendant boxes...

The typewriting machine, when played with expression, 
is no more annoying than the piano when played by a 
sister or near relation.
                             -- Oscar Wilde
Received on Friday, 13 September 2002 19:06:31 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:27:03 UTC