This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 15748 - top margin edge - hence static position - is not well-defined
Summary: top margin edge - hence static position - is not well-defined
Status: NEW
Alias: None
Product: CSS
Classification: Unclassified
Component: CSS Level 2 (show other bugs)
Version: unspecified
Hardware: All Windows 3.1
: P2 normal
Target Milestone: ---
Assignee: Bert Bos
QA Contact: public-css-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-27 18:40 UTC by Anton P
Modified: 2012-12-04 00:53 UTC (History)
0 users

See Also:


Attachments

Description Anton P 2012-01-27 18:40:37 UTC
Reported by Anton Prowse

10.6.4 concerning the height of absolutely positioned elements says:

   # [...] the static position for 'top' is the distance from the top
   # edge of the containing block to the top margin edge of [...]

But vertical margin edges are not well-defined for elements whose 
margins participate in margin collapsing.  This is most noticeable for 
self-collapsing elements, such as in the following test case in which 
there is no sensible relationship between the border box position of the 
"tricky" element (as determined by 8.3.1) and its 20px bottom margin:

<div style="border-bottom:1px solid"></div>
<div id="tricky" style="margin-bottom:20px">
     <div style="margin-top:10px"></div>
</div>
<div style="border-top:1px solid"></div>

For the most part this glitch doesn't cause us any problems since elsewhere the 
spec avoids (albeit probably unconsciously) identifying individual 
margin pieces from amongst a collapsed margin lump.  However, 10.6.4 
relies on identifying the top margin edge of a box which may very well 
participate in margin collapsing.  For example, where should the absolutely positioned element be drawn in the following test case, and why?

<div style="border-bottom:1px solid; margin-bottom:20px"></div>
<div style="position:absolute; width:100px; height:100px; background: 
yellow; margin-top:10px"></div>
<div style="border-top:1px solid; margin-top:20px"></div>

There's no interop on this issue, but that's because Fx and IE don't 
perform tentative margin collapsing at all for abspos in order to 
determine their static position.  (Indeed, UAs are free to make a guess 
at static position.)  Op and Sf do perform tentative margin collapsing and they seem to first calculate the top border position when determining the static position and then add on the top margin width to represent the "top margin edge position".

Conversation begins:
Bug description:
http://lists.w3.org/Archives/Public/www-style/2011Mar/0638.html
Comment 1 Anton P 2012-01-27 18:43:29 UTC
My proposal (incorporating Peter Moulder's comments):

Define static position in terms of top border edge instead of top margin edge.  I'm not suggesting actually changing any behaviours, of course; so the definition would have to factor the top margin width back in to the calculation.  (I think this is the Op/Sf approach mentioned in the previous comment.)

http://lists.w3.org/Archives/Public/www-style/2011Apr/0016.html
http://lists.w3.org/Archives/Public/www-style/2011Apr/0038.html