Performance: Text alignment utilities
Text alignment utilities affect the browser's style calculation and paint stages, influencing how text is visually positioned without changing layout structure.
<div class="text-center px-3">Centered Text</div>
<div style="text-align: center; padding-left: 10px; padding-right: 10px;">Centered Text</div>| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Inline style text-align | No extra DOM nodes | 0 reflows | Triggers paint for text alignment | [OK] |
| Bootstrap text alignment utility class | No extra DOM nodes | 0 reflows | Minimal paint cost, cached styles | [OK] Good |
text-start for left, text-center for center, and text-end for right alignment.text-end aligns text to the right side of the container.text-{breakpoint}-{alignment} for responsive text alignment.text-sm-center.<p class="text-md-end">Hello Bootstrap!</p>
text-md-endtext-md-end.text-center-sm. What is the problem with this class?text-center-sm meaningtext-start (applies by default). Center on medium screens uses text-md-center. Right on large screens uses text-lg-end.text-start text-md-center text-lg-end correctly uses text-start, text-md-center, and text-lg-end in proper order and syntax.Pass the test and this pattern moves unknown