Performance: Descendant selector
MEDIUM IMPACT
This affects how quickly the browser matches CSS rules to elements, impacting style calculation and rendering speed.
.menu-link { color: red; }
div ul li a span { color: red; }| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Deep descendant selector (e.g., div ul li a span) | High (checks multiple ancestors) | 0 (no layout change) | Low | [X] Bad |
| Class selector (e.g., .menu-link) | Low (direct match) | 0 (no layout change) | Low | [OK] Good |