Flexbox & Grid
Helpers for setting the way a single flex or grid item lines up against the cross axis of its parent container.
| Class | Styles |
|---|---|
| self-auto | align-self: auto; |
| self-start | align-self: flex-start; |
| self-end | align-self: flex-end; |
| self-end-safe | align-self: safe flex-end; |
| self-center | align-self: center; |
| self-center-safe | align-self: safe center; |
| self-stretch | align-self: stretch; |
| self-baseline | align-self: baseline; |
| self-baseline-last | align-self: last baseline; |
Reach for the self-auto utility when an item should simply inherit whatever the container's align-items property
<div class="flex items-stretch ..."> <div>01</div> <div class="self-auto ...">02</div> <div>03</div></div>Reach for the self-start utility to pin an item to the start of the container's cross axis, no matter what its align-items value happens to be:
<div class="flex items-stretch ..."> <div>01</div> <div class="self-start ...">02</div> <div>03</div></div>Reach for the self-center utility to seat an item along the center of the container's cross axis, no matter what its align-items value happens to be:
<div class="flex items-stretch ..."> <div>01</div> <div class="self-center ...">02</div> <div>03</div></div>Reach for the self-end utility to push an item to the end of the container's cross axis, whatever the container's align-items value may be:
<div class="flex items-stretch ..."> <div>01</div> <div class="self-end ...">02</div> <div>03</div></div>Reach for the self-stretch utility to let an item grow and fill the container's cross axis, whatever the align-items value may be:
<div class="flex items-stretch ..."> <div>01</div> <div class="self-stretch ...">02</div> <div>03</div></div>Reach for the self-baseline utility to line up an item so its baseline sits on the baseline of the flex container's cross axis:
<div class="flex ..."> <div class="self-baseline pt-2 pb-6">01</div> <div class="self-baseline pt-8 pb-12">02</div> <div class="self-baseline pt-12 pb-4">03</div></div>Reach for the self-baseline-last utility to place an item along the container's cross axis so its baseline meets the last baseline found in the container:
<div class="grid grid-cols-[1fr_auto]"> <div> <img src="img/spencer-sharp.jpg" /> <h4>Spencer Sharp</h4> <p class="self-baseline-last">Working on the future of astronaut recruitment at Space Recruit.</p> </div> <p class="self-baseline-last">spacerecruit.com</p></div>This comes in handy when you want blocks of text to line up neatly, even when each one is a different height.
Add a breakpoint variant such as md: in front of an align-self utility to switch it on only from medium screens upward:
<div class="self-auto md:self-end ..."> <!-- ... --></div>Read more about how variants work in the variants documentation.

6-day email course
Build UIs your users adore.
Bite-sized, hands-on screencasts from the team behind Breezel, sent straight to your inbox each day for a whole week.