Performance: What is an HTML element
HTML elements form the structure of a webpage and affect how quickly the browser can build and display content.
<main><p>Text</p></main>
<div><div><div><p>Text</p></div></div></div>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Deeply nested <div>s | Many nodes, deep tree | Multiple reflows | High paint cost | [X] Bad |
| Semantic elements with minimal nesting | Fewer nodes, shallow tree | Single reflow | Low paint cost | [OK] Good |
HTML element?<p>Hello <strong>World</strong>!</p>
<h1>Welcome to my site<h1>
Pass the test and this pattern moves unknown