2017-01-22 18:36:33 +01:00
# getSize
2019-09-30 10:44:43 +02:00
Get the size of elements.
2017-01-22 18:36:33 +01:00
``` js
var size = getSize( elem );
// elem can be an element
2019-09-30 10:44:43 +02:00
var size = getSize( document.querySelector('#selector ') )
// elem can be a string, used as a query selector
var size = getSize('#selector ')
2017-01-22 18:36:33 +01:00
```
2019-09-30 10:44:43 +02:00
Returns an object with: `width` , `height` , `innerWidth/Height` , `outerWidth/Height` , `paddingLeft/Top/Right/Bottom` , `marginLeft/Top/Right/Bottom` , `borderLeft/Top/Right/BottomWidth` and `isBorderBox` .
2017-01-22 18:36:33 +01:00
Browser support: IE10+, Android 4.0+, iOS 5+, and modern browsers
## Install
2019-09-30 10:44:43 +02:00
Install with [Bower ](http://bower.io ): `bower install get-size`
2018-09-11 12:59:44 +02:00
2019-09-30 10:44:43 +02:00
Install with npm: `npm install get-size`
2018-12-05 13:22:41 +01:00
2017-01-22 18:36:33 +01:00
## Firefox hidden iframe bug
[Firefox has an old bug ](https://bugzilla.mozilla.org/show_bug.cgi?id=548397 ) that occurs within iframes that are hidden with `display: none` . To resolve this, you can use alternate CSS to hide the iframe off-screen, with out `display: none` .
``` css
.hide-iframe {
visibility: hidden;
position: absolute;
left: -999em;
}
```
## MIT License
2019-09-30 10:44:43 +02:00
getSize is released under the [MIT License ](http://desandro.mit-license.org/ ).