← Back to properties

CSS Property

flex-direction

Flexbox

Sets the direction of the main axis in a flex container.

Syntax

flex-direction: value;

Example

flex-direction: row;

Common use cases

  • Horizontal or vertical layouts
  • Reversing element order visually
  • Building navigation bars

Practical developer insight

column-reverse and row-reverse affect tab order visually but not in the DOM — can hurt accessibility.

Related properties