Text Alignment in Bootstrap Framework
Introduction:
Tables are a common element used to present data in a structured format. Aligning text within table cells is crucial for readability and improving the overall presentation. This guide provides insights into utilizing Twitter's Bootstrap framework to achieve text alignment within tables.
Bootstrap 3:
Bootstrap 3 offers straightforward text alignment classes:
For example, to align a table header for a total value to the right:
<th><span class="align-right">Total</span></th>
To align the corresponding table data cell to the right:
<td><span class="align-right">,000,000.00</span></td>
Bootstrap 4 and Bootstrap 5:
In Bootstrap 4 and 5, the text alignment classes have been expanded, providing more granular control:
Additionally, Bootstrap 4 and 5 introduce responsive text alignment classes, allowing for different alignments on different viewport sizes. For example, to align text to the right on large and extra-large viewports:
<p class="text-lg-right text-xl-right">Right aligned text on large and extra-large viewports.</p>
The above is the detailed content of How to Achieve Text Alignment in Bootstrap Tables?. For more information, please follow other related articles on the PHP Chinese website!