align-self
W3C CSS Snapshot 2026
Override the container’s cross-axis alignment for one item.
On this page
Syntax and values
| Value or syntax | What it does |
|---|---|
auto | The initial value. Uses the container’s align-items value in normal flex layout. |
normal / stretch | Stretches the auto-sized item in flex layout. |
start / end | Aligns to the logical start or end of the relevant axis. |
flex-start / flex-end | Follows the start or end of the flex axis. Reverse directions can change which edge this is. |
center | Centers the items or lines along the relevant axis. |
self-start / self-end | Uses the aligned item’s own writing direction. |
baseline / first baseline / last baseline | Aligns first or last text baselines. baseline is the first-baseline form. |
safe center / unsafe center | The safe modifier falls back to start when centering would cause overflow. Unsafe keeps the requested alignment. These modifiers apply to supported positional values. |
Try the example
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>align-self example</title>
<style>
.layout { display: flex; width: min(100%, 320px); border: 2px solid teal; box-sizing: border-box; }
.layout > div { padding: 8px 12px; background: #def5f5; color: #123; border: 1px solid #81b9b5; box-sizing: border-box; }
.layout { height: 140px; align-items: center; gap: 6px; }
.layout .second { align-self: flex-end; }
</style>
</head>
<body>
<div class="layout">
<div class="first">A</div>
<div class="second">B</div>
<div>C</div>
</div>
</body>
</html>
What to expect B aligns at the bottom while A and C stay centered. Change B to auto to use the shared alignment.