How to test a responsive website at every width
Responsive design means one page adapts to any screen width. Testing it well is less about a list of famous devices and more about dragging the width slowly and watching where the content starts to struggle.
Step zero: the viewport meta tag
Without this one line in the page head, phones pretend to be a wide desktop screen and shrink the whole page to fit, so your media queries never fire:
<meta name="viewport" content="width=device-width, initial-scale=1">
If a page looks like a tiny zoomed-out desktop site on a phone, check for this tag before anything else. Avoid adding maximum-scale=1 or user-scalable=no; they stop people from zooming in to read.
How media queries decide
A media query applies rules when a condition about the viewport is true. A mobile-first stylesheet writes the narrow layout as the default and adds wider layouts with min-width:
.cards { display: grid; gap: 16px; }
@media (min-width: 700px) { .cards { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1100px) { .cards { grid-template-columns: repeat(3, 1fr); } }
Widths in media queries are CSS pixels, not hardware pixels. A phone with a 1170-pixel panel and a devicePixelRatio of 3 matches queries as a 390px viewport. The screen size guide explains that conversion.
Container queries go one step further: @container (min-width: 400px) reacts to the width of a parent box rather than the whole window, which suits components reused in a sidebar and a main column.
Choose breakpoints from content, not devices
Device sizes change every year, so a breakpoint list copied from a set of phone models ages quickly. A more durable method:
- Open the page at a narrow width, about 320px.
- Widen the window slowly.
- Stop when the layout starts to look wrong: lines of text too long, cards too stretched, too much empty space.
- Add a breakpoint just before that width and change the layout there.
- Keep widening and repeat until you reach a wide desktop.
Most pages end up needing only two or three breakpoints this way.
Using browser DevTools device mode
Chrome, Edge and Firefox all have a responsive mode. Open DevTools and press Ctrl + Shift + M (on a Mac, Cmd + Shift + M in Chrome or Cmd + Option + M in Firefox). Then:
- Choose “Responsive” and drag the handle to sweep through widths.
- Set a device pixel ratio of 2 or 3 to check that images stay sharp.
- Turn on touch simulation to check tap targets and hover-only menus.
- Throttle the network to a slow profile to see how the page loads on a weak connection.
Device mode simulates width and touch, but it is not the real browser engine of a phone. Finish on at least one real Android phone and one real iPhone if you can, because mobile Safari and mobile Chrome handle some details, such as the address bar and font sizing, differently.
What to look at, width by width
| Check | What failure looks like |
|---|---|
| Horizontal scrolling | The page slides sideways; usually a fixed width, a long URL or a wide table |
| Text line length | Paragraphs stretch across a wide screen and become tiring to read |
| Tap targets | Links and buttons too small or too close to tap reliably |
| Navigation | Menu items wrap onto two lines or hide behind other content |
| Images and video | Overflow their box, or keep a fixed height and get squashed |
| Forms | Labels separated from fields, or inputs wider than the screen |
| Text zoom to 200% | Content overlaps or gets cut off |
A quick way to find what causes sideways scrolling: run document.querySelectorAll('*').forEach(e => { if (e.scrollWidth > innerWidth) console.log(e) }) in the console and look at the elements it lists.
Common mistakes
- Testing only at exact breakpoint widths and missing a problem between them.
- Testing in portrait only. Rotate the device or swap the width and height in device mode.
- Hiding content on mobile instead of reorganising it, so phone users cannot reach it.
- Setting
widthin pixels wheremax-widthwould let the element shrink.
Questions
Why does this page not load other sites in a frame to test them?
Many sites block being shown inside another site’s frame, and a frame does not reproduce a real phone browser anyway. DevTools device mode on your own copy of the page is the more honest test.
Which widths should I always try?
Sweep the full range, and also stop at the narrow end around 320px, a typical phone around 360 to 430px, a tablet around 768px and a laptop around 1280px.