I am having confusion related to offsetTop on MDN it says it returns distance of the outer border of the current element relative to the inner border of the top of the offsetParent node. but when i add margin it returns margin included here is sample code https://jsbin.com/dugajiqaxu/edit?html,output MDN offsetTop page https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetTop
Check out https://javascript.info/size-and-scroll for a visual explanation
Thanks solved in parent element position:relative required then offset margin will not be count
Обсуждают сегодня