Skip to the page
css reference · flexbox

CSS justify-content & align-items

type
property (on the flex container)
applies to
a flex container
inherits
no
common values
justify-content: flex-start/center/space-between; align-items: stretch/center

Where it goes

On the parent that has display: flex. Never on the items themselves.

Example

.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

Common mistakes

  • Mixing up which one goes which way. In a row, justify-content is left to right and align-items is top to bottom.
  • Using justify-content to center one item top to bottom. In a row, that is align-items.

Related

Updated 24 October 2026. Practice it in the css route, or read more on MDN.