<!DOCTYPE html>
<html>
<head>
<style>
#myDIV {
width: 500px;
background-color: lightblue;
overflow: auto;
}
</style>
</head>
<body>
<p>Click the "Try it" button to alert the max-height of the DIV element:</p>
<button onclick="myFunction()">Try it</button>
<div id="myDIV" style="max-height:100px;">
<p>This DIV element does not have a pre-defined height.</p>
<p>The height of this DIV element depends on its content.</p>
<p>But the DIV element has a max-height, and will never exceed 100 pixels.</p>
</div>
<script>
function myFunction() {
alert(document.getElementById("myDIV").style.maxHeight);
}
</script>
</body>
</html>