CSS align-items Property
Description
The align-items property plays a central role in how items are positioned along the cross axis inside a flex or grid container. While the main axis is typically controlled by layout flow (such as row or column direction), align-items determines how child elements are aligned perpendicular to that direction. This makes it especially useful for controlling vertical alignment in horizontal layouts, or horizontal alignment in vertical layouts. It applies to all direct children of a container and provides a consistent way to align content without needing individual adjustments on each item.
In practice, align-items is often used to create visually balanced layouts, such as vertically centering text next to an icon or ensuring that cards in a row align neatly regardless of their internal content. Because it affects all items at once, it helps maintain visual harmony and reduces the need for repetitive styling. It also works closely with layout behavior defined by other properties, such as flex-direction, which determines the orientation of the main and cross axes, and align-content, which controls spacing between multiple rows or columns of items when wrapping occurs.
Another important aspect of align-items is how it interacts with individual elements. While it defines a default alignment for all children, this can be overridden on a per-item basis using align-self. This allows for flexible designs where most items follow a shared alignment, but certain elements can break that pattern when needed. Together, these properties make align-items a key part of building responsive, clean, and predictable layouts - especially when combined with thoughtful use of spacing, sizing, and container structure.
Definition
- Initial value
- stretch
- Applies to
- All elements
- Inherited
- No
- Computed value
- as specified
- Animatable
- yes
- JavaScript syntax
- object.style.alignItems
Interactive Demo
Syntax
align-items: flex-start | flex-end | center | baseline | stretch
Values
- flex-startElements are located at the beginning of the container line. For layout grid elements (grid elements) the abbreviated start value is allowed, for flex elements it is necessary to use the full flex-start value.
- flex-endElements are located at the end of the container line. For layout grid elements (grid elements), the abbreviated end value is allowed; for flex elements, the full flex-end value must be used.
- centerElements are located in the center of the row of the container (middle of the transverse axis, or the axis of the column).
- baselineElements are located on their baseline.
- stretchFlex elements are stretched to fit the container along the transverse axis, layout grid elements are stretched along the column. This is the default value.
Example
Browser Support
The following information will show you the current browser support for the CSS align-items property. Hover over a browser icon to see the version that first introduced support for this CSS property.
This property is supported by all modern browsers.
Desktop
Tablets & Mobile
Last updated by CSSPortal on: 1st January 2026
