Jeroen Coumans wrote: > Hi all, Hoi Jeroen :-)
> I thought I understood absolute and relative positioning > pretty well, but I've hit upon either a bug in Firefox and > Safari (unlikely) or a bug in IE6 (likely) and/or gaps in my > knowledge about this subject (also likely). Please have a look > at the following two documents: > > http://jeroencoumans.nl/test/border.html > http://jeroencoumans.nl/test/no-border.html > > In short: the body is relatively positioned, and in it are > three divs: #content, #left and #right. The latter two are > absolutely positioned to the top and to the left resp. right. > > Strangely enough, when the relatively positioned element > *doesn't* have a border, the absoluteley positioned elements > are positioned *relative* to the non-positioned element! The > no-border.html demonstrates this: only #content has a top > margin, yet both #left and #right start at the same margin. > And even more dubiously, Internet Explorer seems to do the > correct thing - the positioning shouldn't be affected by the > presence of a border, so both files should be rendered the > same. At least, that's what I thought. > > Does anybody have an idea what's going on? Thanks, Well, it's not what you think. What you see happening, is collapsing margins. As soon as you add a border to <body>, the top margin of #content has to stay inside <body>, as it can't collapse with the top margin of <body> anymore. You can check this by just setting a border on the right side of body. You'll see it doesn't extend to the top of the window, but only to the top of body, i.e. 50px from the top of the viewport. So the question is not 'why doesn't position:absolute obey the top of relative positioned ancestor', but 'why does body lose its top margin on receiving a border'. The answer is, that it's not <body> that lost its top margin, it's the top margin of #content that was pushing <body> down 50px first, and isn't now anymore. This you can check very easily: remove the top margin from <body> in your no-border version, and you'll see nothing changes. -- Els http://locusmeus.com/ http://locusoptimus.com/ ______________________________________________________________________ css-discuss [EMAIL PROTECTED] http://www.css-discuss.org/mailman/listinfo/css-d IE7b2 testing hub -- http://css-discuss.incutio.com/?page=IE7 List wiki/FAQ -- http://css-discuss.incutio.com/ Supported by evolt.org -- http://www.evolt.org/help_support_evolt/