Styling & Layout

Reflow triggers

Changing geometry (resizing, editing text, adding elements, changing width or font size) invalidates layout. Reading a layout property like offsetHeight right after such a write forces the pending layout to run immediately. Reflows are expensive.

Setting el.style.width invalidates layout; reading el.offsetWidth right after makes the browser flush it now.

One of 40 cards in the JavaScript deck. Browse every card.