Re: Inconsistent position:relative behaviour

On 2/13/11 6:03 AM, Markus Ernst wrote:
>> Fwiw, setting the parent to overflow:auto would prevent margin collapse
>> too, at the possible cost of scrollbars you may not want.
>
> In my naive understanding, the spec implies that a "clear" property with a value other than "none" would turn off margin collapsing:
>
> "The top margin of an in-flow block box is adjoining to its first in-flow block-level child's top margin if the element has no top border, no top padding, and the child has no clearance."

That's the thing.  "clearance" doesn't mean "'clear' not set to none" it 
means "'clear' affected the margins of this element, because there were 
floats it had to clear".  Like I said, the interaction is complicated. 
This text would be clearer (no pun intended) if it talked about the 
child having nonzero clearance, I think.

> It might be worth to spend some more words on how undesired margin-collapsing can be prohibited, though the spec might be perfectly understandable here for anyone having a full understanding of "clearance".

"clearance" is sort of defined at 
http://www.w3.org/TR/CSS21/visuren.html#flow-control (start at "Values 
other than 'none' potentially introduce clearance.").

> Authors are encouraged to read the spec for reference, and most authors have a less thorough understanding of the details.

In the area of clear + margin-collapse interaction, pretty much no one 
understands the details.  :(

-Boris

Received on Sunday, 13 February 2011 16:59:53 UTC