Flexbox & Grid

align-self

Override cross-axis flex alignment or block-axis grid alignment for one item.

Overview

ClassDeclarations
self-autoalign-self: auto;
self-normalalign-self: normal;
self-baselinealign-self: baseline;
self-centeralign-self: center;
self-stretchalign-self: stretch;
self-startalign-self: start;
self-endalign-self: end;
self-flex-startalign-self: flex-start;
self-flex-endalign-self: flex-end;
self-self-startalign-self: self-start;
self-self-endalign-self: self-end;
self-anchor-centeralign-self: anchor-center;
align-self:<value>align-self: <value>;

Examples

Override alignment for one item

Use self-center to override the parent’s items-start alignment for just the blue item. In this 144px row, the 64px item centers vertically while its 48px sibling remains at the top.

Override alignment for one item
The blue item overrides the parent’s default. Its sibling follows the parent alignment in the same flex line.
<div id="layout" class="flex items-start gap-md h:9rem">  <div id="target" class="self-center h:4rem w:6rem p-sm">Self center</div>  <div id="peer" class="h:3rem w:6rem p-sm">Parent start</div></div>
Generated CSS
@layer utilities {  .flex {    display: flex  }  .items-start {    align-items: start  }  .self-center {    align-self: center  }}

For a flex item, align-self acts on the cross axis. For a grid item, it acts along the block axis inside that item’s grid area.

Stretch a single item

self-stretch fills the line’s cross size when that item’s own cross size is automatic. The blue item stretches to 96px while the parent keeps its other items centered.

Stretch a single item
The blue item overrides the parent’s default. Its sibling follows the parent alignment in the same flex line.
<div id="layout" class="flex items-center gap-md">  <div id="target" class="self-stretch w:6rem p-sm">Auto height</div>  <div id="peer" class="width:6rem height:6rem p-sm">96px height</div>  <div id="item-3" class="h:3rem w:4rem p-sm">48px</div></div>

An explicit height prevents stretching in this row. Use align-items when every item should follow the same default.

Apply conditionally

Use conditional queries to change alignment at a real viewport width. self-auto follows the parent’s items-end value. From sm, self-center overrides that default for the blue item; its sibling stays at the bottom.

Apply conditionally
align-self: Apply conditionally controls
The blue item overrides the parent’s default. Its sibling follows the parent alignment in the same flex line.
<div id="layout" class="flex items-end gap-md h:9rem">  <div id="target" class="self-auto h:4rem w:6rem p-sm self-center@sm">Target</div>  <div id="peer" class="h:3rem w:6rem p-sm">Parent end</div></div>


© 2026 Aoyue Design LLC.MIT License
Trademark Policy