Skip to content

Mobile-First Reflow

Beginner~13 min0/4 steps

Responsive Reality: One Layout, Every Screen

Your design will be viewed on a phone, a tablet, and a giant monitor — sometimes all in the same hour. Responsive design means building one layout that gracefully reshapes itself for each.

The modern trick is mobile-first: you write the phone layout as your default, then layer on changes for bigger screens using Tailwind's responsive prefixes — sm:, md:, lg:. A class with no prefix applies everywhere; md:flex-row only kicks in once the screen is medium or larger.

In this lesson you'll build a hero block that stacks vertically on mobile and sits side-by-side on desktop — the single most common responsive pattern you'll ever build.

Instructions

1

Add a flex container that stacks as a column by default (mobile) and becomes a row on medium screens.

Hint: Use: `<div class="flex flex-col md:flex-row items-center gap-8">` — flex-col stacks, md:flex-row puts them side by side

Where does this go?

<!-- Build a layout that reflows from mobile to desktop -->

Write it on line 12 — under that comment, after the code you already added.

2

Make the container switch to a horizontal row on medium screens and up.

3

Add a heading whose size grows with the screen using responsive text utilities.

4

Add a paragraph that explains the layout reflows from mobile to desktop.

Your Code

html
15 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

Live Preview

Live Preview