<!DOCTYPE html>
<html>
<style>
#myDIV {
top: 40px;
left: 50px;
margin: 10px;
padding: 10px;
width: 300px;
position: relative;
border: 1px solid black
}
</style>
<body>
<h1>The Element Object</h1>
<h2>The offsetTop and offsetLeft Properties</h2>
<div id="myDIV">
<p>The offset values of "myDIV" are:</p>
<p id="demo"></p>
</div>
<script>
const element = document.getElementById("myDIV");
let text = "Left: " + element.offsetLeft + "<br>Top: " + element.offsetTop;
document.getElementById("demo").innerHTML = text;
</script>
</body>
</html>