Answer the question
In order to leave comments, you need to log in
What is the difference between .height and .offsetHeight in JavaScript?
What is the difference between
clientHeight includes padding.
offsetHeight includes padding, scrollBar and borders.
.style.height block height.
I use .style.height for the block - it returns emptiness, and the parent has everything, the child has emptiness (even with a fixed height).
I write offsetHeight - all the rules.
Why is that? and what's the difference?
Answer the question
In order to leave comments, you need to log in
document.element.style.height
to specify the height, this property cannot be read.
Can be done like this ->
getComputedStyle(document.element).height //Вернет высоту
// или так
document.element.offsetHeight
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question