Skip to the page
css reference · flexbox

CSS display: flex

type
property value
applies to
a container, changing how its direct children lay out
inherits
no
common values
flex, inline-flex

Where it goes

On any parent whose children should sit in a row or column instead of stacking.

Example

.row {
  display: flex;
  gap: 12px;
}

Common mistakes

  • Expecting display: flex to reach grandchildren. Tags two levels down are untouched until their own parent is also flex.
  • Putting justify-content or align-items on the children. Those properties only do something on the parent that has display: flex.

Related

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