We're looking for a person or people to help audit MDN to find places we could speed up. Is this you or someone you know? Check out the RFP: https://mzl.la/2IHcMiE

Element.offsetTop Redirect 2

The HTMLElement.offsetTop read-only property returns the distance of the current element relative to the top of the offsetParent node.


topPos = element.offsetTop;


  • topPos is the number of pixels from the top of the parent element.


var d = document.getElementById("div1");
var topPos = d.offsetTop;
if (topPos > 10) {
  // object is offset more
  // than 10 pixels from its parent


Specification Status Comment
CSS Object Model (CSSOM) View Module
The definition of 'offsetTop' in that specification.
Working Draft  

See also

Document Tags and Contributors

 Last updated by: teoli,