vertical align

Utilities for controlling the vertical alignment of an inline or table-cell box.

2025-04-10

Written by: tdtc

ClassStyles
align-baselinevertical-align: baseline;
align-topvertical-align: top;
align-middlevertical-align: middle;
align-bottomvertical-align: bottom;
align-text-topvertical-align: text-top;
align-text-bottomvertical-align: text-bottom;
align-subvertical-align: sub;
align-supervertical-align: super;
align-(<custom-property>)vertical-align: var(<custom-property>);
align-[<value>]vertical-align: <value>;

Aligning to baseline

Use the align-baseline utility to align the baseline of an element with the baseline of its parent:

<span class="inline-block align-baseline">The quick brown fox...</span>

Aligning to top

Use the align-top utility to align the top of an element and its descendants with the top of the entire line:

<span class="inline-block align-top">The quick brown fox...</span>

Aligning to middle

Use the align-middle utility to align the middle of an element with the baseline plus half the x-height of the parent:

<span class="inline-block align-middle">The quick brown fox...</span>

Aligning to bottom

Use the align-bottom utility to align the bottom of an element and its descendants with the bottom of the entire line:

<span class="inline-block align-bottom">The quick brown fox...</span>

Aligning to parent top

Use the align-text-top utility to align the top of an element with the top of the parent element’s font:

<span class="inline-block align-text-top">The quick brown fox...</span>

Aligning to parent bottom

Use the align-text-bottom utility to align the bottom of an element with the bottom of the parent element’s font:

<span class="inline-block align-text-bottom">The quick brown fox...</span>

Using a custom value

Use the align-[] syntax to set the vertical alignment based on a completely custom value:

<span class="align-[4px] ...">
  <!-- ... -->
</span>

Ref