MobileCheck

Website wider than the screen on mobile? How to find and fix horizontal scroll

Updated October 20, 2026 · Covers: The page is wider than the screen

Short answer: A page scrolls sideways on mobile when one element is wider than the screen: usually a fixed-width container, an image without max-width: 100%, a wide table or a long unbroken URL. Find that element and make it flexible instead of hiding the overflow with overflow-x: hidden. WCAG 1.4.10 expects pages to work at 320 CSS px wide without two-way scrolling.

On this page
  1. What does "content wider than the screen" mean?
  2. Why does sideways scrolling matter?
  3. See how your site reads on phones
  4. How MobileCheck finds it
  5. How do I find the element that sticks out?
  6. Common causes and how to fix them
  7. Why is overflow-x: hidden on body a band-aid?
  8. On iPhone vs Android
  9. How do I check the fix?
  10. Frequently asked questions
  11. Sources

If your page scrolls sideways on a phone, one element is almost always wider than the screen. Find it, give it a flexible width (max-width: 100%, min-width: 0 or a wrapping rule), and the whole page snaps back into place. Hiding the overflow on body only hides the symptom.

What does "content wider than the screen" mean?

Something on your page is wider than the phone's screen. Instead of fitting, the page gets a horizontal scroll: visitors can drag it sideways, there is empty space on the right, and the content often wobbles left and right while they scroll down. Text near the right edge may be cut off entirely.

Usually a single element causes it: one image, one table, one long URL or one container with a fixed width.

Why does sideways scrolling matter?

Sideways scrolling is one of the most noticeable signs that a site wasn't built for phones. People scroll vertically with their thumb and rarely expect to pan sideways, so a page that drifts feels broken. If the overflow is large, the browser may also zoom the page out on load to fit the extra width, which makes all the text smaller.

It also fails a basic accessibility requirement. WCAG 2.2 success criterion 1.4.10 (Reflow) asks that content work at 320 CSS pixels wide without scrolling in two directions, except for things like maps, data tables and diagrams that genuinely need two dimensions.

How MobileCheck finds it

MobileCheck compares the page's scroll width with the device's viewport width. If the page is wider, it looks for the deepest elements that reach the right edge of the page and lie past the edge of the screen, and highlights them on the screenshot with how far each one sticks out, for example "sticks out by 84px". Fixed-position and hidden elements are ignored, because they don't create a scrollbar.

The check runs in the normal view, again with large text (150%), and again with the mobile menu opened. A layout that fits at default text size can overflow when people enlarge their font, so a problem that appears only in the large-text scenario usually means a fixed width somewhere around text. See the large text guide for that case.

How do I find the element that sticks out?

If you want to dig in with DevTools, two tricks find almost every overflow.

1. Outline everything

Temporarily add this rule (in DevTools or a test stylesheet) and look for the box that runs past the right edge:

* { outline: 1px solid red; }

Outlines don't take up space, so unlike borders they don't change the layout you are debugging.

2. Ask the page

Paste this into the DevTools console with a phone-sized viewport. It compares the document's scroll width with the screen and lists elements whose right edge is past the screen edge:

const w = document.documentElement.clientWidth;
console.log('page', document.documentElement.scrollWidth, 'screen', w);
document.querySelectorAll('body *').forEach(el => {
  if (el.getBoundingClientRect().right > w + 1) console.log(el);
});

The list includes parents of the culprit too; the innermost element is usually the one to fix.

Common causes and how to fix them

Fixed widths in pixels

A container with width: 1200px or a sidebar with width: 400px can't shrink. Let it be fluid with a ceiling instead:

.container { width: 100%; max-width: 1200px; margin-inline: auto; }

Images, video and embeds

Media render at their natural size unless told otherwise. A short global rule handles most cases:

img, video, iframe, svg { max-width: 100%; height: auto; }

For iframes that need a fixed shape, such as video embeds, set width: 100% together with an aspect-ratio instead of a pixel height.

Long words, URLs and code

A long URL, email address or product code without spaces can't wrap by default. Allow breaking anywhere when needed:

p, li, td { overflow-wrap: anywhere; }
pre { overflow-x: auto; }

overflow-wrap: anywhere only breaks a word when it would otherwise overflow, so normal text is not affected. Code blocks are better given their own horizontal scroll.

Flex and grid items that refuse to shrink

Flex items have min-width: auto by default, which means they won't get narrower than their content. A long word or a wide child inside a flex item pushes the whole row wider. The same happens with 1fr grid columns. The fix is to allow shrinking:

.row > * { min-width: 0; }
.grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }

Wide tables

Data tables often need more room than a phone has. Rather than squeezing them, put the table in its own scroll container so only the table scrolls, not the page:

<div class="table-wrap"><table>…</table></div>

.table-wrap { overflow-x: auto; }

The 100vw pitfall

width: 100vw looks like "full width", but vw is measured against the viewport, including any space taken by a classic scrollbar. On desktop browsers with visible scrollbars, a 100vw element is wider than the page. Adding padding or a margin to a 100vw element overflows on phones as well. Prefer width: 100%, or for full-bleed sections inside a narrow column use a layout that doesn't depend on vw arithmetic.

Negative margins and off-screen positioning

Grid systems with negative row margins, decorative shapes positioned with right: -50px, and animations that start off-screen can all extend the page. Clip them inside their own section with overflow: clip on that section, or move the offset inside the container.

Why is overflow-x: hidden on body a band-aid?

The quickest "fix" you'll find online is body { overflow-x: hidden; }. It hides the symptom, not the cause. The wide element is still wide; its right part is just cut off, so text, buttons or form fields can disappear without anyone noticing. It also behaves inconsistently on mobile, often needs to be on both html and body, and turning an ancestor into a scroll container can break position: sticky on headers inside it.

Fix the element that overflows. If you deliberately have decorative content bleeding out of a section, clip that section, not the whole page. overflow-x: clip is a better choice than hidden there because it clips without creating a scroll container.

On iPhone vs Android

  • Form controls: Safari and Chrome give native inputs different intrinsic widths. Date and time inputs and selects with long options are common iPhone-only culprits inside flex rows. input, select, textarea { max-width: 100%; min-width: 0; } keeps them in bounds on both.
  • Clipping the page: older iOS versions often let people pan sideways even with overflow-x: hidden on body alone, which is one more reason to fix the element rather than the page.
  • Fonts: iPhones use San Francisco and Android phones use Roboto as the system font. Text in system-ui has different widths on each, so a nowrap label can fit on one and overflow on the other.

How do I check the fix?

Run the free check again with a narrow phone (such as iPhone SE or Galaxy S8) and a large one. The report should no longer list sideways-scrolling elements in any scenario, including large text and the open menu. Then open the page on a real phone and try to drag it sideways: it should stay put.

Check Safari as well as Chrome. MobileCheck renders iPhones with WebKit, so engine differences in layout show up in the report; native form controls and Apple's system font are only exact on a real iPhone. The responsive design checker lets you compare several screen sizes in one run.

Frequently asked questions

Why is my website wider than the screen on mobile?

Usually one element is wider than the screen: a fixed-width container, an image without max-width: 100%, a wide table, or a long URL that cannot wrap. Find that element and make it flexible.

Should I just use overflow-x: hidden on the body?

It hides the scrollbar but not the problem: the wide element is still there and its right side gets cut off. Fix the overflowing element instead, and clip only the specific section if you have intentional decorative overflow.

Why does my page only scroll sideways with larger text?

Something has a fixed width that fits the text at default size but not at 150%. Replace fixed widths around text with max-width or flexible layouts, and allow long words to wrap.

Sources

  1. W3C: Understanding SC 1.4.10 Reflow
  2. MDN: overflow-wrap
  3. MDN: overflow (including clip)

Related guides