Responsive design: mobile-first
Your phone layout is your real website now. Google indexes the mobile version of your pages, and most of your visitors arrive on phones. Design for the small screen first, then expand.
The one tag that fixes half of mobile breakage
If your page looks fine on desktop but tiny and zoomed-out on a phone, you are almost certainly missing this line in the <head>:
<meta name="viewport" content="width=device-width, initial-scale=1">
Here is why it matters. Mobile browsers lie about their screen width: without this tag, a phone pretends to be 980 pixels wide, renders the desktop layout, and shrinks it to fit. Your media queries never kick in because the browser claims to be wide. The viewport tag tells the browser to use the device's real width. MDN's guidance is blunt: always include it.
Fluid first, breakpoints second
Before any media query, make the layout flexible. Fixed pixel widths are what break on small screens:
.container {
width: 90%;
max-width: 1100px;
margin: 0 auto;
}
img {
max-width: 100%;
height: auto;
}
A container that is 90% wide with a maximum, and images that never exceed their parent, already survive most screen sizes. Add this before you add a single breakpoint.
Media queries: rules for different widths
Media queries apply styles only when conditions are met. The mobile-first approach: write the narrow layout as the default, then add complexity as the screen grows with min-width:
/* Mobile default: single column */
.cards {
display: grid;
gap: 1rem;
}
/* Wider screens: three columns */
@media (min-width: 768px) {
.cards {
grid-template-columns: repeat(3, 1fr);
}
}
Add breakpoints where your layout actually breaks, not at device names you memorized. Resize the browser slowly; when it looks wrong, that is your breakpoint.
Why Google cares about your phone layout
This is not just about users. Google uses the mobile version of your content, crawled with its smartphone agent, for indexing and ranking. That is official Google documentation, not speculation. And Google explicitly recommends responsive design as the easiest pattern to implement and maintain.
The practical consequence: your mobile page must contain the same content as the desktop page. If the phone version hides text, images, or links to "simplify," Google may never see them.
Test like a visitor, not like a developer
Developers test on their laptop and ship. Visitors arrive on a three-year-old phone with one thumb. Checklist before you call a page responsive:
| Check | How |
|---|---|
| No horizontal scrolling | Shrink the browser to 360px wide; nothing should overflow sideways |
| Text readable without zooming | Body text at least 16px; no pinching required |
| Tap targets big enough | Buttons and links at least 44px tall; no mis-taps |
| Real device, not just DevTools | DevTools device toolbar lies about performance; test on an actual phone |
| Same content as desktop | Compare: nothing important hidden on the small screen |
Worked example: fixing a three column layout that breaks on a phone
Start with a common older layout. A wrapper is set to a fixed width, and three boxes float side by side at a fixed width each:
.wrapper {
width: 1080px;
margin: 0 auto;
}
.column {
float: left;
width: 340px;
margin-right: 20px;
}
On a phone the wrapper stays 1080 pixels wide. The browser either shrinks the whole page until text is unreadable or cuts off the right hand columns and forces sideways scrolling.
Step one is to make widths fluid. Replace the fixed wrapper width with a percentage and a maximum, and let each column take a share of the available space using Grid:
.wrapper {
width: 100%;
max-width: 1080px;
margin: 0 auto;
padding: 0 16px;
}
.columns {
display: grid;
gap: 20px;
}
Step two is to set the phone layout as the default. With no columns defined, Grid stacks the three boxes in one column, in the order they appear in the HTML. Put the main content first in the markup, then supporting material, then the sidebar material, so a phone reader meets the main point before the extras. Reading order on a stacked page comes from the source order.
Step three is to add one breakpoint where the wide layout begins. Pick the width at which three columns stop looking cramped when you resize the browser, and restore the columns there:
@media (min-width: 800px) {
.columns {
grid-template-columns: 1fr 1fr 1fr;
}
}
Step four is to fix tap targets inside the stacked layout. Links that sat close together in a sidebar become a vertical list on a phone, and fingers need more room than a mouse pointer. Give links and buttons enough height and spacing:
.columns a,
.columns button {
min-height: 44px;
padding: 10px 12px;
}
Test the result at a narrow width first, then widen the window slowly. Watch for images that push past their column, long words that overflow a heading, and a menu that still assumes hover. Fix each overflow where it appears, with max-width: 100% on images as the usual first check.
Frequently asked questions
Should I design for specific phones like "iPhone 14"?
No. Design for width ranges, not device names. New phones appear monthly; your breakpoints should follow your content, not Apple's catalog.
Is a separate mobile site (m.example.com) still a thing?
It exists on old sites, but Google recommends responsive design for anything new: one URL, one codebase, no duplication to maintain.
Do I need a CSS framework for responsive design?
No. The viewport tag, fluid widths, and a few media queries cover most sites. Frameworks help on large projects, but they are not a requirement.
Last verified: October 24, 2026, against Google Search Central and MDN Web Docs.
Need a site that works on every screen?
Every site we build is responsive and tested on real devices.
Get a quote →