Return the minimum width of a <p> element: - Javascript CSS Style Property

Javascript examples for CSS Style Property:minWidth

Description

Return the minimum width of a <p> element:

Demo Code

ResultView the demo 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>

<script>
function myFunction() {//w  w w.j a v a  2s  .c  o m
    console.log(document.getElementById("myP").style.minWidth);
}
</script>

</body>
</html>

Related Tutorials