Layout bug · Fix guide

Website Scrolls Sideways on Mobile? How to Find and Fix the Overflow

Updated October 22, 2026

A website scrolls sideways on mobile when at least one element is wider than the phone screen. The usual culprits are fixed pixel widths, images or embeds without max-width: 100%, long unbroken words or URLs, and 100vw sections that ignore the scrollbar. Find the widest element, constrain it, and the sideways scroll disappears.

Quick diagnosis

  • Blank strip on the right side: one element is wider than the viewport. Hunt for it with the console snippet below.
  • Only on one page: an embed, table or image on that page has a fixed width.
  • Only on some phones: a long word, URL or button label that fits at 414px but not at 360px.
  • Started after adding an app or widget: the widget injects a fixed-width container.

Causes and fixes

1

An element has a fixed pixel width

Most common

A container, hero, or section set to something like width: 1200px or min-width: 600px cannot shrink to a 375px phone, so the whole page becomes as wide as that element.

Fix: Swap fixed widths for max-width plus width: 100%, and remove min-width values above 320px from anything that appears on mobile.

2

Images, videos or iframes without max-width

Media with width and height attributes renders at its natural size unless CSS limits it. Map, video and booking-widget embeds often ship as fixed 600px or 800px iframes.

Fix: Add img, video, iframe { max-width: 100%; height: auto; } to your stylesheet, and wrap iframes in a responsive container that uses aspect-ratio.

3

Long words, URLs or email addresses

A long product name, a German compound word, or a pasted URL is one unbreakable string. If it is wider than the screen, it pushes the layout out with it.

Fix: Add overflow-wrap: anywhere; to body text and headings, and shorten button labels so they fit at 360px.

4

Sections sized with 100vw

On browsers with a visible scrollbar, 100vw includes the scrollbar width, so a full-bleed section ends up a few pixels wider than the page and creates a tiny sideways scroll.

Fix: Use width: 100% for full-width sections. If you need a full-bleed breakout, pair it with max-width: 100% on the parent and test on a desktop browser with scrollbars.

5

Negative margins and off-screen animations

Elements pulled outside their container with negative margins, or slide-in animations that start off-screen at translateX(100%), add width to the page while they sit off-canvas.

Fix: Put overflow-x: clip on the section that holds the animation. Avoid overflow-x: hidden on body as a blanket fix: it can break sticky headers and hides the real bug.

6

Tables and code blocks

Data tables, size charts and pre-formatted text do not wrap, so a six-column size chart is wider than any phone.

Fix: Wrap tables in a container with overflow-x: auto so the table scrolls inside its own box instead of moving the whole page.

How to find it on your site

  1. 1

    Open the page at phone width

    In Chrome press F12, then Ctrl+Shift+M (Cmd+Shift+M on Mac), and choose a 360px or 375px device.

  2. 2

    List elements wider than the screen

    Run this in the console: [...document.querySelectorAll("*")].filter(e => e.getBoundingClientRect().right > innerWidth).map(e => e) and check the first result that is not html or body.

  3. 3

    Outline everything

    If the list is long, add * { outline: 1px solid red } in DevTools. The box that sticks out past the right edge is the culprit.

  4. 4

    Fix the widest element first

    Constrain that element with max-width, wrapping, or a scrollable wrapper, then re-run the check. Usually one fix clears the page.

  5. 5

    Check every template

    Product, collection, blog and contact templates each have their own layout. Check one page of each type, or scan the whole site.

Fixes by platform

Shopify

Size-chart tables, review widgets and custom Liquid sections pasted from desktop designs are the usual cause. Check Online Store → Themes → Customize → the section on mobile preview, then look for inline style="width: …px" in custom Liquid blocks.

WordPress

Page builders (Elementor, Divi) let you set per-device widths. A column set to a pixel width on desktop keeps it on mobile unless overridden in the mobile tab. Also check full-width blocks added by your theme.

Wix and Squarespace

Elements dragged partly off-canvas in the editor, or code-block embeds with fixed widths, overflow on mobile. Use the mobile editor view and pull every element inside the page bounds.

Custom code

Add an automated check: Playwright can assert that document.documentElement.scrollWidth <= innerWidth on every route at 375px, so overflow fails CI instead of reaching customers.

Frequently asked questions

Why does my website scroll horizontally on mobile?

Because at least one element is wider than the phone screen. Common causes are fixed pixel widths, images or iframes without max-width: 100%, long unbreakable words or URLs, sections sized with 100vw, and tables that do not wrap.

How do I stop my website from moving side to side on my phone?

Find the element that is wider than the screen using Chrome DevTools at phone width, then give it max-width: 100%, let its text wrap, or wrap it in a container with overflow-x: auto. Avoid hiding the overflow on the body, which masks the bug.

Is overflow-x: hidden on the body a good fix?

Only as a last resort. It hides the symptom, can break position: sticky headers, and leaves content cut off. Fix the element that is too wide instead.

How do I find which element is causing horizontal scroll?

Open DevTools at 375px wide and run a console snippet that lists every element whose right edge is past window.innerWidth, or temporarily outline every element in red and look for the one sticking out.

Does horizontal scrolling hurt SEO?

Content wider than the screen is a mobile usability problem, and Google ranks pages using their mobile version. More importantly, visitors who have to pan sideways to read or tap leave sooner.