Performance: Image sizing basics
HIGH IMPACT
This affects how quickly images load and how smoothly the page renders, impacting the page's loading speed and visual stability.
<img src="photo-200w.jpg" width="200" height="150" alt="Description">
<img src="large-photo.jpg" style="width: 200px; height: auto;">
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Large image resized with CSS only | Low | Multiple reflows as image loads and resizes | High due to repaint | [X] Bad |
| Image sized with width and height attributes | Low | Single layout pass | Low paint cost | [OK] Good |