Performance: Common CSS anti-patterns
HIGH IMPACT
This affects page load speed, rendering time, and visual stability by causing unnecessary style recalculations and layout thrashing.
.link:hover { color: red; }
div.container > ul li.item > a.link:hover { color: red; }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Complex selectors | High (many elements matched) | Medium | Medium | [X] Bad |
| Simple class selectors | Low | Low | Low | [OK] Good |
| Layout-triggering CSS changes | Medium | High (multiple reflows) | High | [X] Bad |
| Transform-based animations | Low | Low | Low | [OK] Good |
| Universal selectors | High | Medium | Medium | [X] Bad |
| Targeted selectors | Low | Low | Low | [OK] Good |
| Frequent !important use | Medium | Medium | Medium | [X] Bad |
| Proper cascade and specificity | Low | Low | Low | [OK] Good |