If you have a Google account, you can save this code to your Google Drive.
Google will ask you to confirm Google Drive access.
Save file as: Save file
Warning: The 10th of June 2021, we will discontinue the ability to save to Google Drive.You will still be able to access your stored code on Google Drive.
If you have saved a file to Google Drive, you can open it here:
Open file
In this example, the child element (#content) inside the first div is bigger than div's height and width (the child is 800x2500 while its parent is 250x400), so we have added a scrollbar.
Click the button to get the clientHeight, offsetHeight, clientWidth and offsetWidth of div.
Notice how the scrollbar in the first div "steals" some of div's right and bottom padding, which results in a lower return value for clientHeight and clientWidth in that div, compared to the other one. The offsetHeight and offsetWidth is not affected by this.
If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:
help@w3schools.com