Responsive Design

Your site on a phone shouldn’t look like a crime scene.

▶ the lesson · narrated sketch video · tap for sound

the intro

Responsive design means one website that adapts to every screen size. You write styles for small screens first, then add media queries as the screen grows. Combined with fluid units and flexible images, the same code works everywhere.

the sample

phone first, then grow

.cards {
  display: grid;
  gap: 16px;
}
@media (min-width: 768px) {
  .cards { grid-template-columns: 1fr 1fr; }
}

fun fact ✦

The term “responsive web design” comes from Ethan Marcotte’s 2010 article — three ideas that changed everything.

the docs

the deep dive

the ideas behind the video — concepts, diagrams, a walkthrough and the traps to avoid

Here is the secret: you have no idea what device visits you. Phones, foldables, TVs, a fridge with a browser. Stop designing for gadgets and design for width — let the content decide when the layout should change, and any device invented next year is already supported.

there is no mobile, there is only width

1 column2 columns3 columns
one codebase, refitting itself

key terms

media query

A conditional wrapper for CSS: these rules apply only when the condition holds, usually a width.

@media (min-width: 48rem)

breakpoint

The width where your layout changes. Derived from where the content breaks, not from any phone model.

you find them by squeezing

viewport

The area of the page the device actually shows. The meta tag tells phones to use their real width.

<meta name="viewport">

fluid unit

Units that scale: %, vw, rem, and clamp() keep things proportional without any query.

font-size: clamp(1rem, 4vw, 2rem)

how it works

  1. 1
    Design the small screen first

    One column, stacked content, no queries needed. This base is also your accessible, no-frills version.

  2. 2
    Add the viewport meta tag

    Without it, phones pretend to be about 980 pixels wide and zoom out. One line, non-negotiable.

  3. 3
    Grow with min-width

    At each breakpoint you add complexity — a second column, a nav bar. Small screens never download the burden.

  4. 4
    Let media and text flow

    Images get max-width: 100%, type gets clamp(). Then squeeze the window and fix whatever breaks.

the code, explained

the whole strategy in five lines

1.cards { display: grid; gap: 12px }
2@media (min-width: 48rem) {
base styles already apply; this only adds at 768px
3 .cards { grid-template-columns: 1fr 1fr }
4}
5h1 { font-size: clamp(1.5rem, 5vw, 3rem) }
fluid text: never below 1.5rem, never above 3rem

side by side

mobile-first

  • base styles fit every screen
  • min-width adds complexity
  • small screens ship lean CSS
  • forces content priorities
VS

desktop-first

  • base styles assume big screens
  • max-width keeps subtracting
  • phones override and undo
  • ships rules phones never use
🪤 gotcha

Your media queries are perfect and the phone ignores them anyway: you forgot the viewport meta tag. Without it, mobile browsers render at roughly 980px wide and scale down, so no query ever fires. It is one line in the head and it has ruined many afternoons.

quick answers

What breakpoints should I use?

Yours: squeeze the window until the layout breaks, and that width is a breakpoint. Most sites need two or three, not twelve.

Do I need a separate mobile site?

Almost never. Separate m-dot sites were the 2010 answer and they double the maintenance. One responsive codebase stays consistent for free.

Mobile-first but desktop looks empty?

That is a design gap, not a CSS one — min-width queries exist to add richness as space grows. Go fill the canvas at 80rem.

quick hits about Responsive Design

short answers · interviews, tips, trivia & hidden gems

🎤 interview

Why write mobile CSS first?watch ↗

📚 tutorial

Where do breakpoints come from?watch ↗

🔧 useful

Why does mobile ignore your media queries?watch ↗

🔧 useful

Testing phones without buying phones?watch ↗

🆕 update

Style a component by ITS own size?watch ↗

🧠 trivia

Who invented responsive design?watch ↗