Utilities
Vertical align
Easily change the vertical alignment of inline, inline-block, inline-table, and table cell elements.
How it works
Change the alignment of elements with the vertical-alignment utilities. Please note that
vertical-align only affects inline, inline-block, inline-table, and table cell elements. It does
not move a block inside its parent — for that use flex
(.align-items-center) or the position utilities.
Choose from .align-baseline, .align-top, .align-middle,
.align-bottom, .align-text-bottom, and .align-text-top as needed.
To vertically center non-inline content (like <div>s and more), use our
flex box utilities.
With inline elements
The spans sit in a line of larger text so the differences are visible.
HTML
<span class="align-baseline">baseline</span>
<span class="align-top">top</span>
<span class="align-middle">middle</span>
<span class="align-bottom">bottom</span>
<span class="align-text-top">text-top</span>
<span class="align-text-bottom">text-bottom</span>HTML
<span class="align-baseline fs-6">baseline</span>
<span class="align-top fs-6">top</span>
<span class="align-middle fs-6">middle</span>
<span class="align-bottom fs-6">bottom</span>
<span class="align-text-top fs-6">text-top</span>
<span class="align-text-bottom fs-6">text-bottom</span>
Title CardWith table cells
On a table cell the utility sets how the cell's content sits within a tall row. This is the one most
people want: .align-middle on the <table> or on a cell with a tall
neighbour.
| baseline | top | middle | bottom | text-top | text-bottom |
HTML
<table class="table" style="height: 100px;">
<tbody>
<tr>
<td class="align-baseline">baseline</td>
<td class="align-top">top</td>
<td class="align-middle">middle</td>
<td class="align-bottom">bottom</td>
<td class="align-text-top">text-top</td>
<td class="align-text-bottom">text-bottom</td>
</tr>
</tbody>
</table>
Tables also accept .align-middle on the
<table>, <thead>, <tbody> or a
<tr>, which cascades through the --bs-table-* rules to every cell.
Icons next to text
The classic use is an inline SVG beside a label. .align-text-bottom usually lines a 1 em
icon up with lowercase letters; .align-middle centres it on the x-height.
Title match — .align-text-bottom
Title match — .align-middle
HTML
<p class="mb-2">
<svg class="align-text-bottom" width="1em" height="1em" viewBox="0 0 16 16" fill="var(--bs-gold-700)" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><path d="M8 1l2.2 4.6 5 .7-3.6 3.5.9 5L8 12.4 3.5 14.8l.9-5L.8 6.3l5-.7z"/></svg>
Title match — <code>.align-text-bottom</code>
</p>
<p class="mb-0">
<svg class="align-middle" width="1em" height="1em" viewBox="0 0 16 16" fill="var(--bs-gold-700)" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><path d="M8 1l2.2 4.6 5 .7-3.6 3.5.9 5L8 12.4 3.5 14.8l.9-5L.8 6.3l5-.7z"/></svg>
Title match — <code>.align-middle</code>
</p>CSS
"align": (
property: vertical-align,
class: align,
values: baseline top middle bottom text-bottom text-top
),