Monday, March 18, 2019

clientHeight versus offsetHeight in JavaScript

This suggests that clientHeight includes padding...

var clientHeight = document.getElementById('myDiv').clientHeight;

 
 

...while offsetHeight includes padding, borders, and scrollbars too!

var offsetHeight = document.getElementById('myDiv').offsetHeight;

No comments:

Post a Comment