offsetHeight property
The offsetHeight property contains
the full height of an element (includes
the element's actual width, border height,
padding, scrollbars):
Syntax
javascriptelement.offsetHeight;
Example
Let's find out the full size of an element:
html<div id="elem"></div>css#elem {
width: 100px;
height: 100px;
padding: 15px;
border: 10px solid black;
}javascriptlet elem = document.querySelector('#elem');
console.log(elem.offsetHeight);
The code execution result:
javascript150
See also
-
the
clientHeightproperty
that contains the height of an element inside bordes -
the
offsetWidthproperty
that contains the full width of an element -
the
getComputedStylemethod
that obtains the value of an element's CSS property