Name

offsetParent — NN n/a IE 4 DOM n/a

Synopsis

Read-only

Returns a reference to the object that is the current element’s containing box. For most elements, this is the BODY object. But elements that are wrapped in DIV elements or are cells of a table have other parents. You can use the returned value in a reference to obtain property information about the containing element, as shown in the following example.

Example

var containerLeft = document.all.elementID.offsetParent.offsetLeft

Value

Object reference.

Default

BODY object.

Get Dynamic HTML: The Definitive Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.