Performance: Border utilities
Border utilities affect the browser's paint and composite stages by adding visual borders to elements, impacting rendering speed and visual stability.
<div class="border border-primary border-3"></div>
<div class="border border-primary border-3 border-top-0 border-end-0"></div>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Multiple conflicting border utilities | No extra DOM nodes | Multiple reflows if borders change | High paint cost due to overlapping borders | [X] Bad |
| Single combined border utility class | No extra DOM nodes | Single reflow | Minimal paint cost | [OK] Good |
border class adds a border on all four sides of an element.border-top or border-left add borders only on one side, not all sides.border -> Option Aborder [OK]border for all sides border fast [OK]border-top as all sides borderborder-none to add borderborder-left adds all bordersborder-0 to remove all borders from an element.border-remove, no-border, and border-none are not valid Bootstrap classes.border-0 -> Option Cborder-0 [OK]border-0 to remove borders quickly [OK]border-noneborder-remove worksborder-0 with adding borders<div class="border-top border-danger p-3">Hello</div>
border-top adds a border only on the top side. The class border-danger colors the border red.border-top + border-danger = red top border [OK]border-danger adds border on all sidesborder-top adds border on all sidesborder-left-3. Why does the border not appear?border for border presence and border-1, border-2, etc. for width, but not combined with side like border-left-3.border-start plus border-3 or just border-start with color. border-left-3 is invalid.border-left-3 is not a valid Bootstrap class -> Option Aborder-left-3border-bottom adds border only on the bottom side. border-4 sets border thickness to 4 (thick).border-primary colors the border blue (Bootstrap primary color).border-bottom border-4 border-primary is correct. border-bottom-4 is invalid.border-bottom border-4 border-primary -> Option Bborder-bottom border-4 border-primary [OK]border-bottom-4Pass the test and this pattern moves unknown