files/en-us/web/css/reference/properties/align-self/index.md
The align-self CSS property overrides a grid or flex item's {{cssxref("align-items")}} value. In grid, it aligns the item inside the {{glossary("Grid Areas", "grid area")}}. In flexbox, it aligns the item on the {{glossary("cross axis")}}.
The property doesn't apply to block-level boxes, or to table cells. If a flexbox item's cross-axis margin is auto, then align-self is ignored.
{{InteractiveExample("CSS Demo: align-self")}}
align-self: stretch;
align-self: center;
align-self: start;
align-self: end;
<section class="default-example" id="default-example">
<div class="example-container">
<div class="transition-all" id="example-element">One</div>
<div>Two</div>
<div>Three</div>
</div>
</section>
.example-container {
border: 1px solid #c5c5c5;
display: grid;
width: 200px;
grid-template-columns: 1fr 1fr;
grid-auto-rows: 80px;
grid-gap: 10px;
}
.example-container > div {
background-color: rgb(0 0 255 / 0.2);
border: 3px solid blue;
}
/* Keyword values */
align-self: auto;
align-self: normal;
/* Positional alignment */
/* align-self does not take left and right values */
align-self: center; /* Put the item around the center */
align-self: start; /* Put the item at the start */
align-self: end; /* Put the item at the end */
align-self: self-start; /* Align the item flush at the start */
align-self: self-end; /* Align the item flush at the end */
align-self: flex-start; /* Put the flex item at the start */
align-self: flex-end; /* Put the flex item at the end */
align-self: anchor-center;
/* Baseline alignment */
align-self: baseline;
align-self: first baseline;
align-self: last baseline;
align-self: stretch; /* Stretch 'auto'-sized items to fit the container */
/* Overflow alignment */
align-self: safe center;
align-self: unsafe center;
/* Global values */
align-self: inherit;
align-self: initial;
align-self: revert;
align-self: revert-layer;
align-self: unset;
auto
normal
start on replaced absolutely-positioned boxes, and as stretch on all other absolutely-positioned boxes.stretch.stretch.stretch, except for boxes with an {{glossary("aspect ratio")}} or an intrinsic size where it behaves like start.self-start
self-end
flex-start
flex-end
center
baseline, first baseline, last baseline
first baseline is start, the one for last baseline is end.stretch
auto, the used size is set to the length necessary to be as close to filling the container as possible, respecting the item's width and height limits. If the item is not auto-sized, this value falls back to flex-start, and to self-start or self-end if the container's {{cssxref("align-content")}} is first baseline (or baseline) or last baseline.anchor-center
anchor-center.safe
start.unsafe
{{CSSInfo}}
{{csssyntax}}
<section>
<div>Item #1</div>
<div>Item #2</div>
<div>Item #3</div>
</section>
section {
display: flex;
align-items: center;
height: 120px;
background: beige;
}
div {
height: 60px;
background: cyan;
margin: 5px;
}
div:nth-child(3) {
align-self: flex-end;
background: pink;
}
{{EmbedLiveSample('Examples')}}
{{Specifications}}
{{Compat}}