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
Issue twelve
Autumn edition
Keep meaningful reading order in the HTML. Reversing a flex direction changes visual order while keyboard navigation retains source order.
<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
| Class | CSS declarations |
|---|---|
flex-row | flex-direction: row; |
flex-col | flex-direction: column; |
flex-row-reverse | flex-direction: row-reverse; |
flex-col-reverse | flex-direction: column-reverse; |
View full generated 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;
}