Performance: Mobile-first approach
MEDIUM IMPACT
This approach affects the initial page load speed and rendering performance on mobile devices by prioritizing simpler styles first.
body { font-size: 1rem; } @media (min-width: 768px) { body { font-size: 1.2rem; } }body { font-size: 1.2rem; } @media (max-width: 767px) { body { font-size: 1rem; } }| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Desktop-first CSS | Same | Multiple reflows due to overrides | Higher paint cost on mobile | [X] Bad |
| Mobile-first CSS | Same | Single reflow on mobile | Lower paint cost on mobile | [OK] Good |