Careeroza
CSS Performance
Fast CSS
- Keep CSS small: remove unused rules (Coverage tab in DevTools, PurgeCSS).
- Minify and compress CSS files; serve them with long cache times.
- Inline only the critical above-the-fold CSS; load the rest normally.
- Avoid
@importchains inside CSS: they download one after another. - Animate
transformandopacity, notwidth,topormargin(those trigger layout). - Use
will-changesparingly, only on elements about to animate. - Use
content-visibility: autofor long, off-screen sections.
Layout, Paint, Composite
| Changing... | Triggers | Cost |
|---|---|---|
width, height, margin, top, font-size | layout + paint + composite | high |
color, background, box-shadow | paint + composite | medium |
transform, opacity | composite only | low |