HTML DOM Element offsetParent Property
Example
Get the offsetParent of "myDIV":
Description
The offsetParent property returns the nearest ancestor that has a position other than static.
The offsetParent property returns null if the element is not visible
(display="none").
Tutorial:
The offsetParent
All block-level elements report offsets relative to the offset parent:
- offsetTop
- offsetLeft
- offsetWidth
- offsetHeight
The offset parent is the nearest ancestor that has a position other than static.
If no offset parent exists, the offset parent is the document body.
See Also:
Syntax
Return Value
Browser Support
element.offsetParent is supported in all browsers:
| Chrome | Edge | Firefox | Safari | Opera | IE |
| Yes | Yes | Yes | Yes | Yes | Yes |