CSS Performance Architecture
Last updated:
CSS structure and rendering discipline together — layers and tokens that stay small, plus selectors and animation that do not tank paint.
01 — Purpose
Structure that stays fast
CSS architecture affects rendering and maintainability — bloated, chaotic stylesheets slow paint and force heavier overrides.
Performance here is not micro-optimising every selector — it is layers, modules, and cascade discipline that keep bundles small and predictable. Runtime rendering issues (layout thrashing, expensive animations) belong in the same conversation once structure is sound.
See CSS architecture, cascade layers, and rendering performance.
02 — Architecture
Systems that scale without bloat
Layer order, tokens, and modular files — not thousands of one-off utilities.
- declare layer order once —
@layer legacy, settings, base, utilities, layout, components, theme, hacks - centralise tokens in settings — see design tokens
- split by component and layout — easier audits and mental mapping
- audit unused rules and bundle size in CI — see performance budgets and performance roadmaps
03 — Rendering
Styles that do not slow paint
Efficient selectors and animation choices reduce layout work and jank.
- restrained specificity — flat selectors; layers over escalation wars
- efficient selectors — avoid universal and deep descendant chains
- animate transform and opacity — not width, height, or top on large surfaces
- limit unused CSS — ship what the route uses; purge dead rules periodically
- avoid
@importchains that block parallel CSS download
04 — Avoid
Architecture that does not scale
Bloated utilities and specificity escalation compound over years.
- bloated utility sprawl — thousands of single-purpose classes
- specificity escalation — chained selectors and !important to win overrides
- monolithic CSS with no layer boundaries
- framework imports with mostly dead code — measure before shipping
05 — Close
Structure is a performance feature
Clean architecture keeps CSS small, predictable, and fast to apply.
Reject PRs that add specificity debt or duplicate patterns already covered by tokens and layers. If a style change regresses INP or scroll, profile layout and paint — then fix structure, not one selector in isolation.
See CSS standard and performance standard.