VOOZH about

URL: https://www.geeksforgeeks.org/bootstrap/bootstrap-5-text-alignment/

⇱ Bootstrap 5 Text Alignment - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Bootstrap 5 Text Alignment

Last Updated : 4 Apr, 2024

Bootstrap 5 text alignment classes are used to realign components with the start, end, and center variation. It can be used in the same viewport width breakpoints as the grid system.

Bootstrap 5 Text alignment Classes: Here * can be replacebale by start, end & center and ** can be replaceble by sm, md, lg & xl

Class NameDescription
text-*Aligns the component's text to the start, center, or end.
text-**-*Aligns the component's text to the start, center, or end based on the screen size breakpoints.

Syntax:

<tag class="text-start">...</tag>

Note:

This class will work on paragraphs, headings, and anchor elements.

The below examples illustrate the Text Alignment:

Examples of Bootstrap 5 Text Alignment

Example 1: In this example, we will align the text to the right by using the text-end class.

Output:

👁 BootstrapTextAlignment
Bootstrap 5 Text Alignment Example Output

Example 2: In this example, we will use all the alignment classes to see the impact of these classes.

Output:

👁 BootstrapTextAlignment2
Bootstrap 5 Text Alignment Example Output
Comment
Article Tags:

Explore