align-self accepts the exact same set of values as align-items, but applies to just the individual flex item it's set on, rather than the whole container's items at once — its default value, auto, simply means the item follows its parent's align-items value normally, and setting align-self to anything else on that specific item overrides that inherited default just for it. This is the standard tool for a specific case, like a single 'skip' button that should align to the top of a row while every other button in that same row centers vertically, without needing to restructure the entire container or wrap that one item in an extra nested flex container.
1Understanding Align-self
align-self accepts the exact same set of values as align-items, but applies to just the individual flex item it's set on, rather than the whole container's items at once — its default value, auto, simply means the item follows its parent's align-items value normally, and setting align-self to anything else on that specific item overrides that inherited default just for it. This is the standard tool for a specific case, like a single 'skip' button that should align to the top of a row while every other button in that same row centers vertically, without needing to restructure the entire container or wrap that one item in an extra nested flex container.
Use align-self on a single flex item specifically when just that one item needs different cross-axis alignment than its siblings — restructuring the whole container or its align-items value is unnecessary when only one specific item needs an exception.
.row {
display: flex;
align-items: flex-start;
}
.highlight {
align-self: center;
}2Practical Example
Here is a real-world application of Align-self showing how it is used in production CSS code.
.card {
display: flex;
flex-direction: column;
align-items: stretch;
}
.card-icon {
align-self: center;
}3Best Practices
Follow these guidelines when working with Align-self:
1. Use align-self on an individual flex item for a targeted alignment exception, rather than changing the whole container's align-items or restructuring the layout
2. Remember align-self's default, auto, simply defers to whatever the parent container's align-items value already is
3. Combine align-self: center with margin-top: auto, or similar, sparingly for more nuanced positioning needs beyond align-self's own standard keyword values
Tip: Use align-self on a single flex item specifically when just that one item needs different cross-axis alignment than its siblings — restructuring the whole container or its align-items value is unnecessary when only one specific item needs an exception.
.row {
display: flex;
align-items: flex-start;
}
.highlight {
align-self: center;
}