offsetHeight
An element property giving its rendered height in pixels, one of several geometry reads that make the browser finish any pending layout first.
In more detail
offsetWidth, offsetTop and getBoundingClientRect() behave the same way. Reading them is fine on its own but costly when mixed with style writes in a loop.
Related terms
- forced synchronous layout — When JavaScript reads a geometry value such as offsetHeight after changing styles, making the browser run layout immediately to give an up-to-date answer.
- layout thrashing — Slowing a page by repeatedly changing styles and then reading sizes, forcing the browser to recalculate layout again and again.
Taught in
- Layout, Reflow, Paint And GPU Compositing Layers — Frontend Architecture & Web Platform