revision:
The property returns the viewable height of an element (in pixels), including padding, border and scrollbar, but not the margin.
The property is read-only.
Syntax:
element.offsetHeight : the viewable height of the element (in pixels) including padding, border and scrollbar.
property value:
none:
example
<div>
<div id="DIV">
<b>Information about this div:</b><br>
Height: 250px<br>
Width: 400px<br>
Padding: 10px<br>
Margin: 15px<br>
Border: 5px<br>
<p id="prop"></p>
</div>
</div>
<style>
#DIV {height: 250px; width: 400px; padding: 10px; margin: 15px; border: 5px solid red;
background-color: lightblue;}
</style>
<script>
const element = document.getElementById("DIV");
let text = "Height including padding and border: " + element.offsetHeight + "px<br>";
text += "Width including padding and border: " + element.offsetWidth + "px";
document.getElementById("prop").innerHTML = text;
</script>
<div id="DIV1">
<b>Information about this div:</b><br>
Height: 250px<br>
Width: 400px<br>
Padding: 10px<br>
Margin: 15px<br>
Border: 5px<br>
<p id="prop1"></p>
</div>
<style>
#DIV1 {height: 250px; width: 400px; padding: 10px; margin: 15px; border: 5px solid red;
background-color: lightblue;}
</style>
<script>
const element1 = document.getElementById("DIV1");
let text1 = "";
text1 += "clientHeight: " + element1.clientHeight + "px<br>";
text1 += "offsetHeight: " + element1.offsetHeight + "px<br>";
text1 += "clientWidth: " + element1.clientWidth + "px<br>";
text1 += "offsetWidth: " + element1.offsetWidth + "px";
document.getElementById("prop1").innerHTML = text1;
</script>