Performance: Headings (h1–h6)
Headings affect page structure rendering and accessibility, impacting how quickly users and browsers understand content hierarchy.
<h1>Main Title</h1> <h2>Section Title</h2>
<div style="font-size:2rem; font-weight:bold;">Main Title</div> <div style="font-size:1.5rem; font-weight:bold;">Section Title</div>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Using styled <div> as headings | Low (few nodes) | Multiple if styles load late | Medium due to repaint | [X] Bad |
| Using semantic <h1>–<h6> tags | Low (few nodes) | Single initial layout | Low paint cost | [OK] Good |
<h1> (largest) to <h6> (smallest).<h1> tag is the biggest and most important heading on a page.<hN>...</hN> where N is a number 1 to 6.<h3> with matching closing tag </h3>.<h1>Title</h1> <h4>Subtitle</h4> <h2>Section</h2>
<h1> largest to <h6> smallest.<h1> Title is largest, <h2> Section is medium, <h4> Subtitle is smaller than h2.<h2>Welcome<h2>
<h2>, but the closing tag is incorrectly written as <h2> instead of </h2>.</h2> to close the heading properly.<h1> for main title, then <h2> for sections, <h3> for subtitles, and <h4> for sub-subtitles.<h1>Main Title</h1>, <h2>Section</h2>, <h3>Subtitle</h3>, <h4>Sub-subtitle</h4> follows the correct descending order from h1 to h4, which helps screen readers and SEO understand content structure.Pass the test and this pattern moves unknown