Performance: Common HTML mistakes
MEDIUM IMPACT
Common HTML mistakes affect page load speed, rendering stability, and user experience by causing unnecessary reflows, layout shifts, or blocking resources.
<header><h1>Title</h1><h2>Subtitle</h2></header>
<div><b>Title</b></div><div><i>Subtitle</i></div>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Using generic <div> with <b>/<i> | Low | 1-2 reflows due to style changes | Medium | [X] Bad |
| Using semantic <header> and <h1>/<h2> | Low | Single reflow | Low | [OK] Good |
| Missing alt attribute on <img> | No extra DOM ops | No reflows | No paint cost | [!] OK but accessibility issue |
| Proper alt attribute on <img> | No extra DOM ops | No reflows | No paint cost | [OK] Good |
| Invalid nesting <p><div> | Browser reparses DOM | Multiple reflows | High | [X] Bad |
| Correct nesting <div><p> | Normal DOM ops | Single reflow | Low | [OK] Good |