Element.offsetParent (Property)

A reference to the parent object that is the reference point for offset positioning values.


JScript - 3.0
Internet Explorer - 4.0
Opera - 5.0
Property/method value type:Element object
JavaScript syntax:IEmyElement.offsetParent

The parent object whose position provides a datum for the element to be offset away from.

This could refer to the document object for the current window. In many cases it will be the BODY object for the document. However you may have used <TABLE> tags to control the layout and these might be the parent objects for the content of the table while the parent of the TABLE objects would be the BODY object.

The parent-child hierarchy of element objects within the document is dependent on how you construct it when the document source is authored.

This is not the same as the parentElement property. That property reflects the true document hierarchy in all its fine detail. The offsetParent property reflects the spatial relationships between objects. Objects that show up in the parentElement hierarchy will likely be omitted from the offsetParent hierarchy model on account of them not contributing any spatial offset to the contained elements.


See also:BODY object, Document object, Element object, Element.offsetLeft, Element.offsetTop, Element.parentElement, Hierarchy of objects, TABLE object

Property attributes:


insert figure 0044