Performance: Button styles and variants
This affects page load speed and rendering performance by matching more CSS rules and increasing style complexity for buttons.
<button class="btn btn-primary btn-lg">Click me</button>
<button class="btn btn-primary btn-lg btn-block btn-outline-secondary">Click me</button>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Multiple button variant classes combined | 1 button element | 1 reflow | Medium paint cost due to complex styles | [X] Bad |
| Single button variant class used | 1 button element | 1 reflow | Low paint cost with simple styles | [OK] Good |
btn to apply button styles.btn-primary class applies the blue color variant to the button.btn-success.btn-sm makes the button smaller in size.<button class='btn btn-warning btn-lg'>Warning</button>
btn-warning applies a yellow/orange color to the button.btn-lg class makes the button larger but does not affect color.<button class='btn btn-info btn-small'>Info</button>
btn-info is a valid Bootstrap variant for a light blue button.btn-sm and btn-lg for sizes, not btn-small.btn-dark-warning. Variants are separate classes like btn-warning (yellow) or btn-dark (dark gray).btn-dark. Adding btn-warning alongside it causes conflicting colors.btn-lg class correctly makes the button large.Pass the test and this pattern moves unknown