Performance: What is CSS
MEDIUM IMPACT
CSS affects how fast the page looks good and how smoothly it responds to user actions.
body { font-size: 1rem; margin: 0; padding: 0; color: black; }body { font-size: 16px; } * { margin: 0; padding: 0; } div, span, p, a, ul, li, h1, h2, h3, h4, h5, h6 { color: black; }| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Broad selectors and universal (*) | High (many elements matched) | Multiple reflows if styles change | High paint cost due to many elements | [X] Bad |
| Specific selectors with grouping | Low (few elements matched) | Single reflow | Low paint cost | [OK] Good |