You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Vertical margin for position=fixed elements is missing #7035
The problem here is likely either that the hypothetical box is wrong or that we aren't taking it into account for position:fixed. You can see which one it is by changing to position:absolute and seeing if the bug persists.
For more info, search for "hypothetical box" in the CSS 2.1 spec.
Okay, I have been at this long enough. I guess take a break from it and hopefully it is on the right track.
By definition, "hypothetical box" for the green square should be at 8px,8px because that is where it would be placed if it were static.
One potential problem is the parent Fragment (presumably for <body>) of the green square's Fragmenthas its vertical margin collapsed (I think), so its box position is at 0px. If the green square is position=static, the parent Fragment has box position at 8px.
So right now, my best guesses. Either:
Somethings is wrong with the collapsed margin algorithm and the margin of the <body> fragment should have collapsed (relevant areas of code: here and here)
Something needs to happen here to set the start position for the green square lower to counter the collapsed vertical margins
When an absolutely positioned element has a static position in an
element with margins collapsed-through, the CSS spec says its position
should be defined by top margin (and not the collapsed top and bottom
margin) of the outermost collapsed-through ancestor.
Activity
frewsxcv commentedon Aug 11, 2015
I am (attempting) to figure this out
pcwalton commentedon Aug 11, 2015
The problem here is likely either that the hypothetical box is wrong or that we aren't taking it into account for position:fixed. You can see which one it is by changing to position:absolute and seeing if the bug persists.
For more info, search for "hypothetical box" in the CSS 2.1 spec.
frewsxcv commentedon Aug 11, 2015
Bug persists with absolute, so I assume the hypothetical box is wrong
frewsxcv commentedon Aug 11, 2015
With respect to the colored box, should all the values for its fragment.margin be 0? I assume so, just double checkingThe answer to my question is 'yes'
frewsxcv commentedon Aug 12, 2015
Okay, I have been at this long enough. I guess take a break from it and hopefully it is on the right track.
By definition, "hypothetical box" for the green square should be at 8px,8px because that is where it would be placed if it were static.
One potential problem is the parent
Fragment(presumably for<body>) of the green square'sFragmenthas its vertical margin collapsed (I think), so its box position is at 0px. If the green square is position=static, the parentFragmenthas box position at 8px.So right now, my best guesses. Either:
<body>fragment should have collapsed (relevant areas of code: here and here)If anyone has hints/tips, let me know
mrobinson commentedon Nov 5, 2015
I attempted to fix this bug last year in https://github.com/mrobinson/servo/tree/margin-collapse, but couldn't manage to do it without introducing other regressions. Perhaps my half-done work will be useful for fixing this.
mrobinson commentedon Nov 5, 2015
I think this describes the bug:
eefriedman commentedon Nov 5, 2015
Yes, that looks right.
nox commentedon Sep 30, 2017
This was fixed.
mrobinson commentedon Sep 30, 2017
@nox Do you know what PR fixed this issue or dd you just notice that the test case is working now?
nox commentedon Sep 30, 2017
The latter.