Javascript DOM CSS Style minHeight Property get

Introduction

Return the minimum height of a <div> element:

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

View in separate window

<!DOCTYPE html>
<html>
<body>

<div style="background:red;min-height:150px;" id="myDiv">This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text.</div><br>

<button type="button" onclick="myFunction()">Return min height of div</button>

<p id="demo"></p>


<script>
function myFunction() {//from   w w w. j  a  v  a2s .c  o  m
  document.getElementById("demo").innerHTML = document.getElementById("myDiv").style.minHeight;
}
</script>

</body>
</html>



PreviousNext

Related