Performance: Why semantic HTML matters
MEDIUM IMPACT
Semantic HTML improves browser rendering efficiency and accessibility, impacting page load speed and user interaction.
<header>Site Title</header> <nav>Menu</nav> <main>Content</main> <footer>Footer info</footer>
<div id="header">Site Title</div> <div id="nav">Menu</div> <div id="main">Content</div> <div id="footer">Footer info</div>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Generic <div> for structure | More nodes and attributes | Multiple reflows if scripts rely on inferred structure | Higher paint cost due to complex layout | [X] Bad |
| Semantic tags like <header>, <nav>, <main>, <footer> | Fewer nodes, clearer structure | Minimal reflows, stable layout | Lower paint cost with predictable layout | [OK] Good |