IT lexicon › Web › Style recalculation

Style recalculation Recalculate Styles

Web På svenska → Updated: 2026-11-15

The rendering pipeline phase where the browser re-evaluates CSS rules against the DOM after a style or structure change.

Whenever the DOM or CSS changes, previously computed styles become invalid and must be recalculated. The Style Engine traverses affected subtrees, re-runs selector matching, and generates new computed values. Smart browsers only invalidate "dirty" nodes and their descendants — but a global change (adding a class to the root) can force recalculation of thousands of elements. Complex selectors (like `:has()`, `:is()`, or descendant chains) scale poorly because each element must be tested against every rule.

Recalculate Styles is one of the heaviest phases in the rendering pipeline and often precedes Layout and Paint. Minimizing recalculations is a key performance strategy: batch DOM changes, avoid reading and writing computed styles in alternating lines, and use CSS classes instead of inline style mutations.

← Back to the lexicon