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, andflex-wrap - Use
shrink-0on icons and avatars so text never crushes them - Use
flex-1to 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.