CSS Performance

Fast CSS

  1. Keep CSS small: remove unused rules (Coverage tab in DevTools, PurgeCSS).
  2. Minify and compress CSS files; serve them with long cache times.
  3. Inline only the critical above-the-fold CSS; load the rest normally.
  4. Avoid @import chains inside CSS: they download one after another.
  5. Animate transform and opacity, not width, top or margin (those trigger layout).
  6. Use will-change sparingly, only on elements about to animate.
  7. Use content-visibility: auto for long, off-screen sections.

Layout, Paint, Composite

Changing...TriggersCost
width, height, margin, top, font-sizelayout + paint + compositehigh
color, background, box-shadowpaint + compositemedium
transform, opacitycomposite onlylow