offsetLeft - offsetTop Properties

calendar December 13, 2009

Value: integer

Compatibility: WinIE4+, MacIE4+, Moz1+, Safari1+

The offsetTop and offsetLeft properties are valuable in providing pixel coordinates of an element within the positioning context  of the parent element even when the elements are not positioned explicitly. The element used as a coordinate context for these properties is whatever element the offsetParent property returns. This means that to determine the precise position of any element you may have to add some code that iterates through the offsetParent hierarchy until that property returns null.

Note: The offsetLeft and offsetTop properties for positioned elements in MacIE do not return the same values as the style.left and style.top properties of the same element.

admin

Leave a Reply

You must be logged in to post a comment.