Flexbox 與 Grid

自身對齊align-self

Controlling how an individual item is aligned along its cross axis.

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 cross-axis alignment for one item

Use self-* utilities when a single flex or grid item needs different cross-axis alignment than its siblings.

<div class="flex items-start gap:md">    <img class="size:10x self-center" src="..." alt="" />    <p class="m:0">Text that controls the row height.</p></div>
Generated CSS
@layer utilities {    .flex {        display: flex    }    .items-start {        align-items: start    }    .self-center {        align-self: center    }}

Stretch a single item

Use self-stretch when one child should fill the cross size even if the group alignment is different.

<button class="self-stretch">...</button>

Use align-items when all items should share the same alignment.

Apply conditionally

Apply styles based on different states using selectors and conditional queries.

<div class="self-auto self-center@sm self-auto@print">...</div>

The effect depends on the parent layout mode and axis.


  • Master UI


© 2026 Aoyue Design LLC.MIT License
Trademark Policy