W3C home > Mailing lists > Public > www-style@w3.org > April 2007

Re: [CSS 2.1] Margins and absolutely positioned elements

From: Eli Friedman <sharparrow1@yahoo.com>
Date: Sat, 7 Apr 2007 04:28:38 -0700 (PDT)
To: (wrong string) �istein E. Andersen" <html5@xn--istein-9xa.com>, www-style@w3.org
Message-ID: <390770.13772.qm@web52104.mail.re2.yahoo.com>

--- "�istein E. Andersen" <html5@xn--istein-9xa.com>
wrote:

> §10.6.4 in the CSS 2.1 specification [1] says:
> > 2. [If] 'top' and 'bottom' are 'auto' and 'height'
> is not 'auto', then set 'top' to
> > the static position, set 'auto' values for
> 'margin-top' and 'margin-bottom'
> > to 0, and solve for 'bottom'

You might want to reread the bit about how the static
position is calculated.

> §8.3.1 [2] gives the following precision:
> > Margins of absolutely positioned boxes do not
> collapse
> 
> This is not, however, quite as specific as what is
> said about floated elements:
> > Vertical margins between a floated box and any
> other box do not collapse

That's just a difference in wording; in the first one,
"with any other box" is implied, and only vertical
margins can collapse.

> This leaves me quite confused. Does §8.3.1 affect
> §10.6.4 in this case?

The margins don't collapse; absolutely positioned
elements without an explicit position use the static
position to calculate their position.  The margin is
then added to this value.  It isn't too hard once you
understand how the static position is calculated. 
(Note that the top margin edge of a box does not
depend on its margin.)

> (Apparently, browsers do dot €˜collapse€™ margins
> in the CSS sense, but rather
> choose to take into account or not the margin on the
> non-absolutely
> positioned element when the position of the
> absolutely positioned element
> is calculated.)

IE6 is rendering this incorrectly; Firefox and Opera
get it right as far as I can tell.

-Eli


 
____________________________________________________________________________________
TV dinner still cooling? 
Check out "Tonight's Picks" on Yahoo! TV.
http://tv.yahoo.com/
Received on Saturday, 7 April 2007 11:28:42 GMT

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