W3C home > Mailing lists > Public > www-style@w3.org > August 2010

Re: [CSS 2.1] [Section 8.3.1] Margin collapsing and top: auto (abs. pos)

From: Alan Gresley <alan@css-class.com>
Date: Tue, 03 Aug 2010 14:57:37 +1000
Message-ID: <4C57A1C1.70109@css-class.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
CC: www-style@gtalbot.org, "www-style@w3.org" <www-style@w3.org>
Tab Atkins Jr. wrote:
> 2010/8/2 "GĂ©rard Talbot" <www-style@gtalbot.org>:
>> Hello all,
>>
>> Are abs. pos. and fixed pos. elements taken out of normal flow before
>> margin collapsing occurs or are abs. pos. and fixed pos. elements taken
>> out of normal flow after margin collapsing occurs?
> 
> Before.
> 
>> Testcase (self-explanatory and reduced)
>> --------
>>
>> http://www.gtalbot.org/BrowserBugsSection/css21testsuite/margin-collapsing-and-abs-pos.html
>>
>>
>> Spec says:
>> "
>> The bottom margin of an in-flow block-level element is always adjoining to
>> the top margin of its next in-flow block-level sibling, unless that
>> sibling has clearance.
>> "
>> http://www.w3.org/TR/CSS21/box.html#collapsing-margins
>>
>> Now, "next in-flow block-level sibling" could mean not just n+1th sibling
>> but n+2th sibling, n+3th sibling, n+kth sibling: this is where
>> interpretation/exegesis seems critical, decisive.
> 
> Sure, it could mean the n+2th sibling, just so long as it's the next
> *in-flow* sibling, like the spec states.
> 
> This doesn't seem to have anything to do with "next children", though.
>  Opera collapses margins correctly in this case, same as anyone else.
> (Put a height and background on #second-static and check its position
> in Opera and other browsers.)
> 
> It's just computing the auto position differently, which it's allowed
> to do.  (The spec only provides suggestions for how to calculate the
> auto position of abspos elements, and explicitly says in 10.3.7 that
> implementations are allowed to "guess at its probable position".)
> 
> ~TJ

This is not quite concerning the computing of the auto position 
differently. If the first static div is given a height of 50px (seen 
in test 2), then the ap. element is positioned 150px from the top of 
the viewport.

<http://css-class.com/test/css/visformatting/margin-collapsing-and-abs-pos1.htm>

<http://css-class.com/test/css/visformatting/margin-collapsing-and-abs-pos2.htm>

<http://css-class.com/test/css/visformatting/margin-collapsing-and-abs-pos3.htm>


Why does the last test case where the first static div is given a 
height of 0px show similar to the first test case where the first 
static div is given a height of 100px?





-- 
Alan http://css-class.com/

Armies Cannot Stop An Idea Whose Time Has Come. - Victor Hugo
Received on Tuesday, 3 August 2010 04:58:13 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:30 GMT