Get the bottom position of a <div> element: - Javascript CSS Style Property

Javascript examples for CSS Style Property:bottom

Description

Get the bottom position of a <div> element:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<div id="myDiv" style="position:absolute;bottom:0px;">This is a div element.</div>

<button type="button" onclick="myFunction()">Return bottom position of div</button>

<script>
function myFunction() {/*from ww w  .  j  a  va2  s. c o  m*/
    console.log(document.getElementById("myDiv").style.bottom);
}
</script>

</body>
</html>

Related Tutorials