Tailwind Flexbox lesson

Choose the flex direction

A flex container lays its children out in a row by default. Tailwind’s direction utilities let you choose whether the main axis runs across or down the page.

Utilities

ClassWhat it does
flex-rowPlaces items from left to right.
flex-row-reversePlaces items from right to left.
flex-colStacks items from top to bottom.
flex-col-reverseStacks items from bottom to top.

Try it

Add flex to the parent, then use flex-col when a card, menu, or toolbar needs a vertical stack.

<div class="flex flex-col gap-4">
  <header>Title</header>
  <main>Content</main>
  <footer>Actions</footer>
</div>

Practice in Flexwind Froggy

More flexbox lessons