zig.com Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<body>
<div id="myDiv" style="position:absolute;top:75px;">This is a div.</div>
<button type="button" onclick="myFunction()">Return top position of div</button>
<script>
  function myFunction() {
    alert(document.getElementById("myDiv").style.top);
  }
</script>
</body>
<!-- /jsref/tryit.asp?filename=tryjsref_style_top3 Thu, 06 Feb 2025 18:36:43 GMT -->
</html>