Skip to content
Guest
Tailwind CSS · Course Syllabus Show lessons
Layouts · 8 min read · Beginner

Flexbox Layouts: Navbars, Toolbars & Alignment

Build sticky headers, button groups, and vertically centered rows cleanly with Tailwind Flexbox utilities.

What you'll learn

  • Align axes with `items-center`, `justify-between`, and `flex-wrap`
  • Use `shrink-0` on icons and avatars so text never crushes them
  • Use `flex-1` to let search inputs expand naturally

Overview

Build sticky headers, button groups, and vertically centered rows cleanly with Tailwind Flexbox utilities.

Code Example

<header class="flex h-16 items-center justify-between gap-4 px-6">
  <a href="/" class="flex items-center gap-2 font-extrabold">DevPath</a>
  <nav class="flex items-center gap-2">
    <a href="/courses" class="rounded-xl px-3 py-2 text-sm font-semibold">Courses</a>
  </nav>
</header>

Key Takeaways

  • Align axes with items-center, justify-between, and flex-wrap
  • Use shrink-0 on icons and avatars so text never crushes them
  • Use flex-1 to let search inputs expand naturally

Quick Check

Check Your Understanding

Score: 0 / 1

1. What does `shrink-0` prevent on an icon inside a flex row?

Study Workspace

Finished this lesson?

Your progress is saved locally in your browser, no account needed.

Search courses, lessons, and references

Type to search across all courses, lessons, and quick references.

Press Esc to close Powered by Pagefind