CSS Align-Items Property

Pascual Vila
Frontend Instructor.
The align-items property is a sub-property of the Flexible Box Layout module. It defines the default behavior for how flex items are laid out along the Cross Axis on the current line.
Understanding the Cross Axis
To understand align-items, you must understand the axes. If your flex-direction is row (default), the Cross Axis is vertical. Therefore, align-items controls vertical alignment. If your direction is column, the Cross Axis is horizontal.
Key Values
- stretch (default): Stretch to fill the container (respects min-width/max-width).
- flex-start: Items align to the start of the cross axis (top, usually).
- flex-end: Items align to the end of the cross axis (bottom, usually).
- center: Items are centered along the cross axis.
- baseline: Items align such that their baselines align.
Common Confusion: Justify vs Align
Remember: justify-content is for the Main Axis. align-items is for the Cross Axis.