stretch, the default, stretches items to fill the container's full cross-axis size, unless an item has an explicit size set on that axis, flex-start and flex-end align items toward the corresponding edge of the cross axis, center centers them, and baseline aligns items so their text baselines line up with each other, useful when items have differently-sized content or font sizes but should still visually align on the same text line. align-items sets the alignment for every flex item in the container at once; the related align-self property overrides this default for one specific individual item.
1Understanding Align-items
stretch, the default, stretches items to fill the container's full cross-axis size, unless an item has an explicit size set on that axis, flex-start and flex-end align items toward the corresponding edge of the cross axis, center centers them, and baseline aligns items so their text baselines line up with each other, useful when items have differently-sized content or font sizes but should still visually align on the same text line. align-items sets the alignment for every flex item in the container at once; the related align-self property overrides this default for one specific individual item.
align-items: stretch is the default cross-axis behavior — if flex items with no explicit height look like they're unexpectedly filling the container's full cross-axis size, that's exactly this default stretching behavior at work, not a mistake.
.navbar {
display: flex;
align-items: center;
}2Practical Example
Here is a real-world application of Align-items showing how it is used in production CSS code.
.price-row {
display: flex;
align-items: baseline;
}
<div class="price-row">
<span style="font-size: 32px;">$99</span>
<span style="font-size: 14px;">/month</span>
</div>3Best Practices
Follow these guidelines when working with Align-items:
1. Use align-items: center as one of the most common patterns for vertically centering flex items relative to each other in a row-direction container
2. Use align-items: baseline specifically when items contain differently-sized text that should still visually align along a shared text baseline
3. Use align-self on an individual item when just that one item needs different cross-axis alignment than the rest, rather than restructuring the whole container's align-items
Tip: align-items: stretch is the default cross-axis behavior — if flex items with no explicit height look like they're unexpectedly filling the container's full cross-axis size, that's exactly this default stretching behavior at work, not a mistake.
.navbar {
display: flex;
align-items: center;
}