Browse documentation

Reference / Flexbox & grid

Flex direction

Stack items vertically or place them in a row. Switch direction at a breakpoint to give wide screens a compact header.

Working example

Keep meaningful reading order in the HTML. Reversing a flex direction changes visual order while keyboard navigation retains source order.

HTML
<header class="flex flex-col gap-2 sm:flex-row sm:justify-between">
  <h3 class="font-semibold">Issue twelve</h3>
  <p class="text-neutral-600">Autumn edition</p>
</header>

Class reference

ClassCSS declarations
flex-rowflex-direction: row;
flex-colflex-direction: column;
flex-row-reverseflex-direction: row-reverse;
flex-col-reverseflex-direction: column-reverse;
View full generated CSS
Compiled CSS
.flex-col {
  flex-direction: column;
}
.flex-col-reverse {
  flex-direction: column-reverse;
}
.flex-row {
  flex-direction: row;
}
.flex-row-reverse {
  flex-direction: row-reverse;
}