Edit This Code:
<!DOCTYPE html>
<html>
<body>

<div style="background:red;max-width:60px;" 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 max width of div</button>

<script>
function myFunction() {
    alert(document.getElementById("myDiv").style.maxWidth);
}
</script>

</body>
</html>


Result:
Try it Yourself - © w3schools.com
Privacy Policy