Take the 2-minute tour ×

Is it possible to get the position of an element in the body even when it has position:static?

EG: if I have three elements one after another:

<div id="1"></div>
<div id="2"></div>
<div id="3"></div>
<div id="4"></div>

Each element has 25px. I want to able to find the position of element with id=3. (it should return 50px)

How can I do it?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

How about offsetTop


also offsetLeft to get the horizontal position



share|improve this answer
add comment

Your Answer


