Performance: Combining & with pseudo-classes
MEDIUM IMPACT
This affects CSS selector matching speed and rendering performance by how browsers find and apply styles.
&:hover { color: red; } &.active { color: red; } &::before { color: red; }&:hover, &.active, &::before { color: red; }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Combined & with multiple pseudo-classes in one selector | Low to medium | Multiple on state change | Medium | [X] Bad |
| Separate & with single pseudo-class selectors | Low | Minimal on state change | Low | [OK] Good |