Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Layout with Flexbox | Section
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
Tailwind CSS for React Development

bookLayout with Flexbox

Swipe to show menu

Tailwind provides utility classes to build flexible layouts using Flexbox.

Enable Flexbox

<div className="flex">
  <div>Item 1</div>
  <div>Item 2</div>
</div>

flex: enables flex layout.

Direction

<div className="flex flex-col">
  <div>Item 1</div>
  <div>Item 2</div>
</div>

flex-col: stacks items vertically.

Align Items

<div className="flex items-center">
  <div>Item</div>
</div>

items-center: aligns items vertically.

Justify Content

<div className="flex justify-between">
  <div>Left</div>
  <div>Right</div>
</div>

justify-between: spreads items horizontally.

Gap Between Items

<div className="flex gap-4">
  <div>Item 1</div>
  <div>Item 2</div>
</div>

gap-4: adds space between items.

Use Flexbox utilities to control direction, alignment, and spacing in layouts.

question mark

Which Tailwind CSS utility class enables Flexbox layout on a container?

Select the correct answer

Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 1. Chapter 4

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

Section 1. Chapter 4
some-alt