Performance: ID selectors
LOW IMPACT
ID selectors affect how quickly the browser matches CSS rules to elements during style calculation.
#header { color: blue; } #footer { color: blue; } #sidebar { color: blue; }
#header, #footer, #sidebar { color: blue; }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Using #id selector | Single element matched quickly | 0 | Low | [OK] Good |
| Using multiple ID selectors in one rule | Multiple single element matches | 0 | Low | [OK] |
| Overusing IDs for styling many elements | Inefficient CSS management | 0 | Low | [!] |