Javascript DOM CSS Style bottom Property get

Introduction

Return the bottom position of a <div> element:

alert(document.getElementById("myDiv").style.bottom);

View 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>

<p id="demo"></p>
<script>
function myFunction() {//  ww w. ja  v  a2s  .c o m
  document.getElementById("demo").innerHTML = document.getElementById("myDiv").style.bottom;
}
</script>

</body>
</html>



PreviousNext

Related