DOM Element Dimensions and CSS Transforms

added by JavaScript Kicks
6/14/2019 7:26:08 AM


In a recent issue of my newsletter, I briefly discussed many (if not all?) of the different ways you can retrieve a DOM element's dimensions via JavaScript. These include: Using getBoundingClientRect()'s width and height properties Via offsetWidth and offsetHeight Using window.getComputedStyle() By means of the document.styleSheets object Using scrollWidth and scrollHeight As you probably know, these features don't work in the same way, so they don't give you identical results.