Interview Question

How do you optimize CSS performance?

Optimize measured bottlenecks across loading, style calculation, layout, and paint.

💡 Concept ✅ Quick Revision 🎨 CSS

Answer

CSS performance work reduces unnecessary transfer, style calculation, layout, paint, and compositing. • Remove unused rules and avoid shipping large style sheets to pages that do not need them. • Prefer simple maintainable selectors and avoid repeated layout-triggering script changes. • Measure with browser performance tools before and after optimization.

💡 Simple Example

.offscreen-panel { content-visibility: auto; contain-intrinsic-size: auto 40rem; }

⚡ Quick Revision

Optimize measured bottlenecks across loading, style calculation, layout, and paint.