Javascript DOM CSS Style minWidth Property get

Introduction

Return the minimum width of a <p> element:

alert(document.getElementById("myP").style.minWidth);

View in separate window

<!DOCTYPE html>
<html>
<body>
<p style="background:red;min-width:600px;" id="myP">
The minimum width of this paragraph is set to 600px.</p>

<button type="button" onclick="myFunction()">Return min width</button>

<p id="demo"></p>
<script>
function myFunction() {/*from  w w  w. j  ava 2s.c  om*/
  document.getElementById("demo").innerHTML = document.getElementById("myP").style.minWidth;
}
</script>

</body>
</html>



PreviousNext

Related