Performance: Display headings
This affects the page's rendering speed and visual stability by controlling how headings are styled and sized.
<h1 class="display-1">Heading</h1>
<h1 style="font-size: 4rem; font-weight: 300;">Heading</h1>| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Inline styles on headings | Minimal | Triggers style recalculation per element | Low but repeated | [X] Bad |
| Bootstrap display heading classes | Minimal | Single style calculation reused | Low and efficient | [OK] Good |
display-1 to display-4?display-1 to display-4 are used to style headings with bigger and bolder text.<h1> tag?class attribute with the exact class name, e.g., class="display-3".<h1 class="display-3">Title</h1> uses class="display-3" correctly. Other options misuse attribute syntax or class names.<h2 class="display-1">Big Heading</h2> <h2>Normal Heading</h2>
display-1 classdisplay-1 class makes text very large and bold compared to normal heading styles.display-1 will appear much bigger and bolder than the second heading without any display class.<h3 class="display5">Heading</h3>
display-1, display-2, up to display-4. There is no display5 class.display5 without a dash, which is invalid and will not apply the style.display-1 (largest) to display-4 (smaller). There is no display-5.display-1 for biggest size, subheading can use display-4 for smaller but styled text.<h1 class="display-1">Main Title</h1> <h2 class="display-4">Sub Title</h2> uses correct classes and semantic tags. Other combinations either use non-existent classes like display-5, reverse the size order (smaller main heading with display-4, larger subheading with display-1), or omit display classes entirely.Pass the test and this pattern moves unknown