What would make offsetParent null?

Posted by Brian Ramsay on Stack Overflow See other posts from Stack Overflow or by Brian Ramsay
Published on 2008-11-20T18:17:45Z Indexed on 2010/04/27 23:23 UTC
Read the original article Hit count: 299

Filed under:
|

I am trying to do positioning in JavaScript. I am using a cumulative position function based on the classic quirksmode function that sums offsetTop and offsetLeft for each offsetParent until the top node.

However, I am running into an issue where the element I'm interested in has no offsetParent in Firefox. In IE offsetParent exists, but offsetTop and offsetLeft all sum up to 0, so it has the same problem in effect as in Firefox.

What would cause an element that is clearly visible and usable on the screen to not have an offsetParent? Or, more practically, how can I find the position of this element in order to place a drop-down beneath it?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about positioning