I have slightly edited the test to meet the current version of the spec. CSSOM View Module W3C Working Draft, 17 March 2016 7. Extensions to the HTMLElement Interface https://www.w3.org/TR/cssom-view-1/#dom-htmlelement-offsetparent - - - - - - - - (In reply to Jaroslav Zaruba from comment #3) > Obviously this also means that there is currently no way to compute actual > offset (position) of an elment with position:fixed. Correct. > offsetTop: > "If the offsetParent of element A is null or the HTML body element return > the distance, as number of CSS pixels, between the top border edge of > element A and the canvas origin and stop this algorithm." > > Currently the offsetTop property of position:fixed element always contains 0. In a test page, I am able to get the offsetTop property of a 'position: fixed' element (which is not 0) with Firefox 47 and Chrome 51. But the spec says it should not be possible since offsetParent of a 'position: fixed' element should be null.
Bug 434678 Comment 6 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
Current version of the spec.: CSSOM View Module W3C Working Draft, 16 September 2025 7. Extensions to the HTMLElement Interface https://www.w3.org/TR/cssom-view/#dom-htmlelement-offsetparent - - - - - - - - (In reply to Jaroslav Zaruba from comment #3) > Obviously this also means that there is currently no way to compute actual > offset (position) of an elment with position:fixed. Correct. > offsetTop: > "If the offsetParent of element A is null or the HTML body element return > the distance, as number of CSS pixels, between the top border edge of > element A and the canvas origin and stop this algorithm." > > Currently the offsetTop property of position:fixed element always contains 0. In a test page, I am able to get the offsetTop property of a 'position: fixed' element (which is not 0) with Firefox 47 and Chrome 51. But the spec says it should not be possible since offsetParent of a 'position: fixed' element should be null.