Performance: Placeholder selectors with %
MEDIUM IMPACT
This affects CSS bundle size and rendering speed by reducing duplicated styles and minimizing CSS rules sent to the browser.
%common-style { color: red; font-weight: bold; }
.button { @extend %common-style; }
.alert { @extend %common-style; }.button { color: red; font-weight: bold; } .alert { color: red; font-weight: bold; }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Repeating styles in multiple selectors | N/A | 0 | Low | [X] Bad |
| Using % placeholder selectors with @extend | N/A | 0 | Low | [OK] Good |