Performance: Heading classes
MEDIUM IMPACT
This affects page load speed and rendering performance by controlling how heading styles are applied and how many CSS rules the browser must process.
<h1 class="display-1">Title</h1> <h2 class="display-2">Subtitle</h2>
<h1 class="custom-large-heading custom-bold custom-color">Title</h1> <h2 class="custom-large-heading custom-bold custom-color">Subtitle</h2>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Multiple custom classes per heading | Low (few nodes) | Multiple reflows due to style recalculations | Medium paint cost | [X] Bad |
| Bootstrap heading classes (e.g., display-1) | Low (few nodes) | Single reflow per class application | Low paint cost | [OK] Good |