Last active
December 30, 2015 17:59
-
-
Save lolikroli/7864506 to your computer and use it in GitHub Desktop.
Get height and width of an element.
From http://stackoverflow.com/questions/526347/css-javascript-how-do-you-get-the-rendered-height-of-an-element
The same properties for width.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var h = document.getElementById('someDiv').clientHeight;//includes the height and vertical padding. | |
var h = document.getElementById('someDiv').offsetHeight;//includes the height, vertical padding, and vertical borders. | |
var h = document.getElementById('someDiv').scrollHeight;//includes the height of the contained document (would be greater than just height in case of scrolling), vertical padding, and vertical borders. | |
//properties for width are the same |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment