Performance: Button sizes
MEDIUM IMPACT
Button sizes affect the layout stability and rendering speed of interactive elements on the page.
<button class="btn btn-primary btn-sm">Small</button> <button class="btn btn-primary btn-lg">Large</button>
<button class="btn btn-primary" style="padding: 0.25rem 0.5rem; font-size: 0.75rem;">Small</button> <button class="btn btn-primary" style="padding: 1rem 2rem; font-size: 1.5rem;">Large</button>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Inline styles with varying sizes | Low | Multiple reflows per button | High due to layout shifts | [X] Bad |
| Bootstrap size classes (btn-sm, btn-lg) | Low | Single reflow on load | Low paint cost, stable layout | [OK] Good |