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

[CSS 2.1] Margins and absolutely positioned elements

From: Øistein E. Andersen <html5@xn--istein-9xa.com>
Date: Sat, 07 Apr 2007 11:30:28 +0200
To: www-style@w3.org
Message-Id: <E1Ha7Fc-000FEv-3O@node1-3.ouvaton.local>

The page http://html5.ouvaton.org/bugs3.html exemplifies a case where
absolutely positioned elements are positioned differently in different browsers.

§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'

§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

This leaves me quite confused. Does §8.3.1 affect §10.6.4 in this case?
(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.)

I have not studied the specification in its entirety, so I may well have
missed a relevant passage. Would someone care to explain how the
tests are supposed to be rendered?


Thanks in advance,
Øistein E. Andersen

[1] http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-height
[2] http://www.w3.org/TR/CSS21/box.html#collapsing-margins
Received on Saturday, 7 April 2007 09:31:31 GMT

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