Home » Speed & Mobile » Site Broken on Mobile: Test Responsive Layouts Before Visitors Find the Bugs
Site Broken on Mobile: Test Responsive Layouts Before Visitors Find the Bugs
More than half of web traffic comes from phones, yet many sites are designed and checked only on a laptop. On a phone, the same site may have text running off the side, a menu that will not open, buttons too close together to tap, or a pop-up that cannot be closed. Visitors leave rather than wrestle with it.
Start by confirming the page has a viewport meta tag. Without it, nothing else in this guide will help.
Step 1: test across widths
In Chrome or Firefox, open DevTools and toggle device mode (Ctrl+Shift+M / Cmd+Shift+M). Then:
- Pick a small phone preset (360 px wide is a good worst case).
- Load your key pages: home, a post, a category, contact, and checkout if you have one.
- Switch to Responsive and drag the width slowly from 320 px up to 1400 px. Watch for the moment things overlap or jump.
Step 2: look for the usual failures
| What you see | Likely cause | Fix |
|---|---|---|
| Page scrolls sideways | An element wider than the screen | Find it (see below); use max-width: 100% |
| Text overlaps or is cut off | Fixed heights or absolute positioning | Let height grow; use normal flow or flex/grid |
| Columns squashed side by side | No breakpoint to stack them | Add a media query or a grid that wraps |
| Menu missing or will not open | Desktop menu hidden, mobile toggle broken | Check the toggle's JavaScript and CSS |
| Tiny text | Font sizes in px set too small | Base size at least 16px |
| Links and buttons too close | Small tap targets | Add padding; at least 44×44 px |
| Pop-up covers the page, no close button visible | Fixed-size modal | Make it fit the screen; keep close button in view |
| Form fields zoom the page on focus (iOS) | Input font below 16px | Set inputs to 16px |
Step 3: find what overflows
Paste this into the DevTools Console to outline every element wider than the screen:
document.querySelectorAll('*').forEach(el => {
if (el.getBoundingClientRect().right > document.documentElement.clientWidth) el.style.outline = '2px solid red';
});
Usual suspects: images and videos without max-width: 100%, tables, code blocks, long URLs, embeds from other sites, and elements with fixed width values.
Step 4: fix layouts the flexible way
Prefer layouts that adapt by themselves over many breakpoints:
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.container { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
The grid stacks cards automatically on narrow screens. The container never exceeds the screen and always keeps a small gutter.
Step 5: test on real devices
Check at least one iPhone and one Android phone, in both portrait and landscape:
- Open and close the menu, then follow a link from it.
- Fill in and submit a form with the on-screen keyboard open.
- Scroll a long page and check that sticky headers or cookie banners do not cover content.
- Use the site on mobile data, not only Wi-Fi.
If you have no devices to hand, services such as BrowserStack provide real phones in the browser for a fee.
Step 6: make it part of every change
Layout bugs creep back with new content: a wide table in a post, a new embed, a long product name. Check new pages on a phone before publishing.
Common mistakes
- Hiding overflow with
overflow-x: hiddeninstead of fixing the wide element. - Testing only on the developer's own phone.
- Designing hover-only interactions that cannot be used with touch.
- Letting cookie banners and chat widgets cover half the screen on small phones.
Frequently Asked Questions
Which screen widths should I test?
Test a small phone (about 360 px), a large phone (about 414 px), a tablet (768 px) and a small laptop (1280 px). Also drag the browser window slowly through every width in between; layouts often break at odd sizes.
Is the browser's device mode good enough?
It catches most layout problems. It does not show real touch behaviour, browser toolbars, on-screen keyboards or performance on a slower phone, so check on at least one real device.
How big should buttons and links be on mobile?
Aim for tap targets of at least 44 by 44 CSS pixels, with some space between them, so people can hit them reliably with a thumb.
Found a mistake or still stuck? Contact us. See how we write and check these guides in our editorial policy, or read about DocumentGuy.