Flexbox & GridAlign Self

Align Self

Controls the positioning of a single flex or grid element along the transverse axis of its container.

Widely available

This feature is well established and works across many devices and browser versions.

Chrome
Edge
Firefox
Safari
ClassStyle
as-autoalign-self: auto;
as-balign-self: baseline;
as-calign-self: center;
as-fealign-self: flex-end;
as-fsalign-self: flex-start;
as-stalign-self: stretch;

Auto

Initial value

The item will use the default alignment based on the container's alignment properties.

A
B
C
<div class="d-f g-4 h-24 w-full">
<div class="ai-c bg-indigo-8 d-f f-1 jc-c p-4 tc-indigo-5">A</div>
<div class="ai-c as-auto bg-indigo d-f f-1 jc-c p-4 tc-white">B</div>
<div class="ai-c bg-indigo-8 d-f f-1 jc-c p-4 tc-indigo-5">C</div>
</div>

Baseline

The item will be aligned along the baseline of the container.

A
B
C
<div class="d-f g-4 h-24 w-full">
<div class="ai-c bg-indigo-8 d-f f-1 jc-c p-4 tc-indigo-5">A</div>
<div class="ai-c as-b bg-indigo d-f f-1 jc-c p-4 tc-white">B</div>
<div class="ai-c bg-indigo-8 d-f f-1 jc-c p-4 tc-indigo-5">C</div>
</div>

Center

The item will be centered within its container.

A
B
C
<div class="d-f g-4 h-24 w-full">
<div class="ai-c bg-indigo-8 d-f f-1 jc-c p-4 tc-indigo-5">A</div>
<div class="ai-c as-c bg-indigo d-f f-1 jc-c p-4 tc-white">B</div>
<div class="ai-c bg-indigo-8 d-f f-1 jc-c p-4 tc-indigo-5">C</div>
</div>

Flex-End

The item will be aligned to the end of its container.

A
B
C
<div class="d-f g-4 h-24 w-full">
<div class="ai-c bg-indigo-8 d-f f-1 jc-c p-4 tc-indigo-5">A</div>
<div class="ai-c as-fe bg-indigo d-f f-1 jc-c p-4 tc-white">B</div>
<div class="ai-c bg-indigo-8 d-f f-1 jc-c p-4 tc-indigo-5">C</div>
</div>

Flex-Start

The item will be aligned to the start of its container.

A
B
C
<div class="d-f g-4 h-24 w-full">
<div class="ai-c bg-indigo-8 d-f f-1 jc-c p-4 tc-indigo-5">A</div>
<div class="ai-c as-fs bg-indigo d-f f-1 jc-c p-4 tc-white">B</div>
<div class="ai-c bg-indigo-8 d-f f-1 jc-c p-4 tc-indigo-5">C</div>
</div>

Stretch

The item will stretch to fill its container along the cross axis.

A
B
C
<div class="d-f g-4 h-24 w-full">
<div class="ai-c bg-indigo-8 d-f f-1 jc-c p-4 tc-indigo-5">A</div>
<div class="ai-c as-s bg-indigo d-f f-1 jc-c p-4 tc-white">B</div>
<div class="ai-c bg-indigo-8 d-f f-1 jc-c p-4 tc-indigo-5">C</div>
</div>

Using utility variants

Learn how to override existing utilities based on the user's screen size or other factors, such as hover states.

Targeting different viewports

You can combine responsive breakpoints like sm:as-*, md:as-*, lg:as-*, and xxl:as-* to allow targeting specific utilities in different viewports.

Targeting hover states

Alternatively, you can apply :hover by using h:as-* utility to override elements and change their values when hovering over them.