View Full Version : spec confusion

12-19-2006, 07:41 AM
I'm confused about collapsing margins in the context of nested elements. The two quotes below from the W3C CSS2.1 spec. seem to contradict -I think!

If, as described below, an element is confined to the padding or content area of its containing block (one of its ancestors), how can the margins of one element nested inside another ever adjoin -and therefore collapse?

From 8.3.1 Collapsing margins:
"In this specification, the expression collapsing margins means that adjoining margins (no non-empty content, padding or border areas or clearance separate them) of two or more boxes (which may be next to one another or nested) combine to form a single margin."

From 10.1 Definition of "containing block":
"The containing block of an element is defined as follows:...if the element's position is 'relative' or 'static', the containing block is formed by the content edge of the nearest block-level, table cell or inline-block ancestor box."

For absolutely positioned elements, the spec. talks the containing block being formed by the padding edge of the ancestor.

Hopefully I'm missing something obvious!