What would make offsetParent null?

I have made a test of 2,304 divs with unique combinations of values for position, display, and visibility, nested inside unique combinations of each of those values, and determined that:

an otherwise-valid element
that is a descendant of <body>
will not have an offsetParent value if:

  • The element has position:fixed (Webkit and IE9)
  • The element has display:none (Webkit and FF)
  • Any ancestor has display:none (Webkit and FF)

It is also reasonable to expect that an element that has no parent, or that is not added to the page itself (is not a descendant of the <body> of the page), will also have offsetParent==null.


If the document hasn't finished loading then offsetParent can be null