VOOZH about

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

⇱ Bootstrap 5 Vertical Alignment - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Bootstrap 5 Vertical Alignment

Last Updated : 23 Jul, 2025

Bootstrap 5 Vertical Alignment facilitates aligning inline, inline-block, inline-table, and table cell elements vertically within their container. It offers classes for top, bottom, middle alignment, and stretching content to fill vertical space, enhancing layout flexibility in web development.

Bootstrap 5 Vertical Alignment Classes:

Class NameDescription
align-baselineAligns the baseline of the element with the baseline of its parent.
align-topAligns the top of the element with the top of the line.
align-middleAligns the middle of the element with the middle of the parent.
align-bottomAligns the bottom of the element with the bottom of the line.
align-text-bottomAligns the bottom of the element with the bottom of the parent element's text.
align-text-topAligns the top of the element with the top of the parent element's text.

Syntax:

<span class="align-top">....</span>

Examples of Bootstrap 5 Vertical Alignment

Example 1: This example shows the use of vertical alignment classes to align span elements inside a paragraph.

Output:

👁 Bootstrap-vertical
Bootstrap 5 Vertical Alignment Example Output

Example 2: In this example, we show the use of the align-baseline, align-top, align-middle, and align-bottom classes using images.

Output:

👁 BootstraoVertical-2
Bootstrap 5 Vertical Alignment Using table Cell Example Output
Comment

Explore