Testing Responsive Layouts Across Device Widths
July 27, 2026 · DevTools
You built a mobile-first layout. It looks perfect in Chrome DevTools' device toolbar at 375px wide. You deploy. A customer on a Pixel 6 (which has a 412px CSS width due to a 60px browser chrome and a 3x device pixel ratio) sees a layout shift. Another customer on an iPad in landscape reports the three-column grid is only showing two columns. Device testing is not just about screen width — it is about pixel density, viewport size, and the policies sites use to control embedding.
The Responsive Tester previews any URL at preset device widths, revealing layout problems at the breakpoints that matter.
CSS pixels vs. device pixels
The CSS pixel (also called the logical pixel) is the unit in CSS media queries and layout calculations. It is not the same as the physical display pixel.
A 375px-wide phone screen with a 2x device pixel ratio (DPR) has 750 physical pixels across. CSS reports it as 375px. A 4K monitor at 100% zoom has a DPR of 1, so CSS pixels and physical pixels align.
iPhone 14: 393 CSS px × 852 CSS px (1170 × 2556 physical at 3x DPR)
iPad Pro 12": 1024 CSS px × 1366 CSS px (2048 × 2732 physical at 2x DPR)
Desktop 1080p: 1920 CSS px × 1080 CSS px (1920 × 1080 physical at 1x DPR)
This is why CSS media queries work regardless of DPR — the browser does the translation. A max-width: 768px query targets the CSS pixel width, not the physical pixel width.
The breakpoints that matter
Rather than testing every possible width, target the common layout breakpoints:
| Width | Target |
|---|---|
| 375px | Small phones (iPhone SE, most Android) |
| 390–428px | Regular phones (iPhone 12–14) |
| 768px | Tablets portrait, small laptops |
| 1024px | Tablets landscape, laptops |
| 1280px | Desktop 720p+ |
| 1536px | Desktop 1080p+ |
The specific breakpoint values depend on your design, but testing at these six widths covers the layout transitions in most designs.
Viewport meta and how it controls mobile rendering
<!-- Without viewport meta: desktop layout scaled down to fit mobile screen -->
<!-- With viewport meta: layout at actual mobile width -->
<meta name="viewport" content="width=device-width, initial-scale=1">
width=device-width sets the layout viewport to the device's CSS width. initial-scale=1 sets the initial zoom to 1×. Without this meta tag, mobile browsers use a virtual viewport (defaulting to ~980px) and scale the entire page down to fit — which defeats responsive design.
If your layout looks "zoomed out" on mobile, check for a missing or misconfigured viewport meta tag.
Why some sites block iframes
When you try to test stripe.com or bank.example in the Responsive Tester, you may see a blank frame or a security error. This is intentional.
Sites set X-Frame-Options: SAMEORIGIN or X-Frame-Options: DENY to prevent clickjacking attacks — embedding the site in an invisible iframe and capturing user interactions. The header tells the browser: "do not render me in a frame on a different origin."
X-Frame-Options: DENY → never in a frame
X-Frame-Options: SAMEORIGIN → only in a frame on the same origin
Content-Security-Policy: frame-ancestors 'none' → modern equivalent
Content-Security-Policy: frame-ancestors 'self' → only same origin
This is correct behavior from a security standpoint. For testing these sites, use browser DevTools instead of an iframe-based tester. For testing your own site, use the Responsive Tester with your local development server.
Testing strategy
Test your own site (local or on a staging server):
- Start your dev server
- Open the Responsive Tester
- Enter your local URL (e.g.,
http://localhost:3000) - Cycle through the device presets
- Check navigation, grid layouts, image sizing, and form inputs at each width
Common issues to look for:
- Horizontal scrolling — an element wider than the viewport (a non-responsive image, a
position: fixedsidebar, a long un-broken word withoutoverflow-wrap) - Text too small on mobile — font sizes in
pxthat do not scale with the viewport. Useremorclamp()for fluid typography. - Touch targets too small — interactive elements smaller than 44×44 CSS pixels are hard to tap accurately
- Images not resizing —
imgelements withoutmax-width: 100%overflow their container on small screens - Z-index issues at specific widths — a dropdown or modal that gets covered by another element when the viewport changes
Aspect ratio and responsive images
For responsive images, the aspect-ratio CSS property prevents layout shifts as images load:
img {
max-width: 100%;
height: auto;
}
.avatar {
aspect-ratio: 1 / 1; /* forces square, prevents reflow */
object-fit: cover;
}
Use the Aspect Ratio Calculator to find the right ratio for your image containers.
For testing complex grid layouts, the CSS Grid Generator and Flexbox Playground let you experiment with responsive patterns at different widths before committing them to code.