Get the total height of an element, optionally including its margins.
Source code viewer
// The getBoundingClientRect().height method does not include margins. It only includes the element's height, padding, and borders. const height = element.getBoundingClientRect().height; const heightWithMargin = element.getBoundingClientRect().height + parseFloat(style.marginTop) + parseFloat(style.marginBottom);Programming Language: Javascript