Layouts · 8 min read · Beginner
Mobile-First Breakpoints & Container Queries
Design for 375px screens first and progressively enhance for tablets, laptops, and ultrawide monitors.
What you'll learn
- Switch stacked mobile buttons (`w-full`) to inline desktop buttons (`sm:w-auto`)
- Hide secondary desktop nav links cleanly with `hidden md:flex`
- Test every component at 375px, 768px, and 1280px
Overview
Design for 375px screens first and progressively enhance for tablets, laptops, and ultrawide monitors.
Code Example
<div class="flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
<h2 class="text-xl font-bold sm:text-2xl">Dashboard</h2>
<button class="w-full rounded-2xl bg-blue-600 px-5 py-3 text-white sm:w-auto">New Project</button>
</div>
Key Takeaways
- Switch stacked mobile buttons (
w-full) to inline desktop buttons (sm:w-auto) - Hide secondary desktop nav links cleanly with
hidden md:flex - Test every component at 375px, 768px, and 1280px
Quick Check
Check Your Understanding
Score: 0 / 1
1. At what viewport width does `md:flex` take effect in Tailwind CSS?
Study Workspace
Finished this lesson?
Your progress is saved locally in your browser, no account needed.