How do I align text in tables using Bootstrap?

Patricia Arquette
Release: 2024-11-01 12:01:02
Original
804 people have browsed it

How do I align text in tables using Bootstrap?

Text Alignment Classes in Bootstrap

In Bootstrap, there are various text alignment classes available to align text within tables.

Bootstrap 3

  • text-left: Aligns text to the left.
  • text-center: Centers text horizontally.
  • text-right: Aligns text to the right.
  • text-justify: Justifies text across the entire width.
  • text-nowrap: Prevents text wrapping.

Example:

<code class="html"><th class="text-right">Total</th>
<td>,000,000.00</td></code>
Copy after login

Bootstrap 4

Similar to Bootstrap 3, Bootstrap 4 also provides text alignment classes:

  • text-xs-left: Left-aligns text on all viewport sizes.
  • text-xs-center: Centers text on all viewport sizes.
  • text-xs-right: Right-aligns text on all viewport sizes.
  • Additionally, text-sm-left, text-md-left, text-lg-left, and text-xl-left specify left-alignment for specific viewport sizes (e.g., sm for small, md for medium, etc.).

Bootstrap 5

In Bootstrap 5, text-left has been replaced with text-start, and text-right has been replaced with text-end. Otherwise, the text alignment classes remain the same.

The above is the detailed content of How do I align text in tables using Bootstrap?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!