How to Fix Mobile Horizontal Scroll Overflow in CSS (2-Minute Fix)

If your website slides sideways on a phone, one element on the page is wider than the screen. Find that element, fix its width, and the sideways scroll is gone — usually in about two minutes, with a few lines of CSS and no rebuild. The usual culprits are a fixed-width box, an image with no max-width, a long email address or web address that cannot wrap, a footer grid that refuses to stack, or a wide table or code block. Below is the check, the exact way to find the culprit, and the fix for each cause — including the three we found on our own site in November 2026.
Want us to fix it for you? Every site we build is checked on a real phone before it goes live — see our custom web development service.
First, check it on a real phone in 2 minutes
Do not start in code. Start on your phone, the way a customer sees the site.
- Open your homepage on your phone and try to swipe it left and right. If the page moves sideways at all, you have the problem.
- Check a second page — your contact page, or any page with a table, a price list or a long email address. The homepage can be clean while another page overflows.
- Check a small screen, not just your own phone. Many Android phones are 360 pixels wide, and the accessibility standard is 320. A page that fits your phone can still break on a cheaper one.
If you have a laptop nearby, there is a one-line test in Chrome DevTools. Open the page, press F12, go to the Console tab and paste document.documentElement.scrollWidth > window.innerWidth. If it returns true, something on the page is wider than the screen. If it returns false, the page fits — test another page.
Google used to warn you about this: its Search Console Mobile Usability report flagged pages with "content wider than screen". But Google retired that report, the Mobile-Friendly Test tool and its API on 1 December 2023 (Google Search Central blog). Nobody emails you about it now — the two-minute phone check is the warning system.
Find the one element that sticks out
A page scrolls sideways because of one element — usually just one — that refuses to shrink. The fix is not to squeeze the whole page. It is to find that element and fix its width.
Paste this one line into the DevTools console on your own page. It lists every element whose right edge passes the edge of the screen:
[...document.querySelectorAll('body *')].filter(el => el.getBoundingClientRect().right > window.innerWidth)
The list can be long, because a wide parent makes its children stick out too. Ignore the children. Fix the outermost element — the one whose parent still fits inside the screen. That is the element setting the width. Bugviso's October 2026 test of 188 homepages found 5.9% scrolled sideways at 390 pixels, doubling to 12.2% at 360 pixels — a common Android width.
No laptop? Ask your developer to run the line and send you the name of the outermost element. You do not need to understand the code to act on the answer.

The 6 causes — and the fix for each
Almost every case is one of these six. Match what you found to the row, apply the fix, and re-check on the phone.
| Cause | How to spot it | Fix |
|---|---|---|
| No viewport meta tag | The whole page looks tiny, like a desktop site shrunk down | Add <meta name="viewport" content="width=device-width, initial-scale=1.0"> in the <head> |
| Fixed-width element | A box set to a pixel width, e.g. width: 960px | Change it to max-width: 100% so it can shrink |
| Image with no max-width | A photo or banner wider than the phone | img { max-width: 100%; height: auto; } |
| Long email or web address | A long address with no spaces that cannot wrap | overflow-wrap: anywhere on the container, or show a shorter address |
| Footer or grid that will not stack | Three columns side by side on a phone screen | Stack to one column under 960px, or use grid-template-columns: repeat(3, minmax(0, 1fr)) |
| Wide table or code block | A price table or code sample running off the edge | Wrap it in a container with overflow-x: auto — it scrolls inside its own box, not the page |
Not sure which row is yours? Get an instant estimate for a mobile layout fix — most take less than an hour of work.
How we fixed it on our own site
In November 2026 our own site, metaprime.online, scrolled sideways on phones. The cause was not one thing — it was three, and all three were pre-existing, not caused by any new feature.
- The footer stayed three columns on phones. The rule stacking it to one column below 960 pixels was being beaten by a stronger rule, so we fixed the order.
- Our long contact email address forced the page wider. An email address has no spaces, so it cannot wrap — it pushed its container past the edge of the screen. We let it wrap and break.
- Blog code blocks had no overflow rule. A wide code sample stretched the whole article. We gave code blocks their own horizontal scroll, so the block scrolls and the page does not.
After those three fixes the sideways scroll was gone. The cause is almost never the whole page — it is one or two elements, each with a small, specific fix. That is why we check every site on a real phone before it goes live: a desktop browser hides this problem completely.
What not to do: overflow-x: hidden is a band-aid
The most common advice online is to add overflow-x: hidden to the page. It stops the sideways movement — by cutting off whatever sticks out. The content past the edge is still there, just unreachable: a button nobody can tap, an address nobody can read.
It also fails the accessibility standard: WCAG 2.2 Success Criterion 1.4.10 (Reflow) asks for content that works at 320 CSS pixels wide without scrolling in two directions. Hiding overflow does not make content fit — it makes it disappear. Bugviso's October 2026 test found 13.3% of homepages already hid overflow this way.
Use it only as a temporary guard while you fix the real cause — never as the fix itself. On our own site we keep it only below 640 pixels as a safety net, after fixing the three causes above.
Why it matters: the numbers
Phones are not a side channel any more. StatCounter put mobile at 59.9% of worldwide web page views in October 2026, against 38.5% for desktop — and in the United States mobile was 45.4% (StatCounter Global Stats, October 2026). If your layout breaks on a phone, a large share of your visitors only ever see the broken version.
A visitor who has to scroll sideways to read your phone number or tap your button usually just leaves — they cannot see what slid off-screen and will not pinch and drag to find it. If the page is also slow, the damage doubles: our guide to sub-0.8s page speeds covers the weight side, and heavy JavaScript hurts the same pages on Core Web Vitals, as our Core Web Vitals guide explains.
The 5-minute checklist
Run it on every page that matters, and repeat it after every deploy — new images and embeds are the usual repeat offenders.
- Open the site on a real phone. Swipe sideways on the homepage and the contact page.
- Run the scrollWidth check at 360 pixels and at 320 pixels in DevTools.
- Run the element-finder line. Note the outermost element that sticks out.
- Match it to the table above and apply the fix.
- Re-check on the phone. Repeat until nothing moves sideways.
- After every future change, check again before it goes live.
If the page still scrolls after the table fixes, the cause is usually an absolutely positioned decoration, a slide-out menu, or an embedded map or video with a fixed width — the same finder line will name it. Send the name to your developer with this checklist; the fix is usually a one-line change. Or send us the link on WhatsApp and we will tell you which element it is.
Frequently asked questions
Why does my website scroll sideways on mobile?
One element on the page is wider than the phone screen — a fixed-width box, an image with no max-width, a long email address, a footer grid that will not stack, or a wide table. Find the outermost element with the console line in this guide and fix its width.
Is overflow-x: hidden a proper fix for horizontal scroll?
No. It hides the symptom by cutting off whatever sticks out, so buttons and addresses past the edge become unreachable. It also fails WCAG 2.2 Reflow (1.4.10). Fix the element that is too wide instead, and use overflow-x: hidden only as a temporary guard.
How do I find which element causes horizontal scroll?
In Chrome DevTools, paste [...document.querySelectorAll('body *')].filter(el => el.getBoundingClientRect().right > window.innerWidth) into the console. It lists every element past the right edge — fix the outermost one, whose parent still fits.
What does “content wider than screen” mean?
It was Google's Search Console error for a page wider than the phone screen. Google retired that report, the Mobile-Friendly Test tool and its API on 1 December 2023, so you now find it yourself with the two-minute phone check in this guide.
Can I fix horizontal scroll without a developer?
If the cause is a missing viewport tag or an image with no max-width, yes — the fixes in the table are a few lines of CSS. If your theme or builder will not let you edit CSS, send your developer the outermost element name and this checklist.