How to stop horizontal scrolling on a mobile website
Horizontal scrolling happens when one element on the page is wider than the phone screen. Find that element, make it fit the screen width, and the sideways wobble stops.
If your page slides left and right when you swipe on a phone, something on it is wider than the screen. Usually it is one image, table, video, banner or line of text, and it drags the whole page wider with it. The fix is rarely big, but you have to find the right element first.
What people see
On a phone, the page can be dragged sideways. You might see a strip of empty white space on the right, content cut off at the edge, or a page that loads zoomed out so everything looks tiny. Sometimes only one page is affected, such as a page with a wide pricing table or an embedded map.
Visitors rarely tell you about this. They just leave.
Why it matters
- Trust and sales: a page that wobbles feels broken. People hesitate to enter card details or send an enquiry on a site that feels unfinished.
- Usability: buttons and text near the edge can be hard to reach, and visitors can lose their place while scrolling down.
- Search: Google mostly uses the mobile version of your pages. A page that does not fit a phone screen is a poor mobile experience, and that can work against you.
This is a visual and usability problem, not a security one.
How to check if your site has it
These checks are free:
- Open your site on a real phone. Put a finger on the page and drag left and right. If it moves, you have the problem. Test the home page, a product or service page, the contact page and any page with a table or embed.
- On a computer, open the page in Chrome, press
F12, then click the phone and tablet icon (device toolbar). Pick a narrow size such as 375 pixels wide and look for a horizontal scrollbar at the bottom. - To find the culprit, open the Console tab in the same tools and paste this:
document.querySelectorAll('*').forEach(el => { if (el.getBoundingClientRect().right > document.documentElement.clientWidth) console.log(el); });
It lists every element that sticks out past the right edge of the screen. Click one in the console and the browser highlights it on the page. Ignore elements that are hidden on purpose, such as an off-screen menu that is meant to slide in.
SiteMonday's week 5 mobile usability test also looks at how your pages behave on a phone, so it is one way to catch this without checking each page by hand.
The usual causes
- An element with a fixed width, for example
width: 800px, or an image with a large set width. - Images, videos or embedded iframes (maps, booking widgets) without
max-width: 100%. - Wide tables, such as price lists or timetables.
- Long words or web addresses that cannot wrap onto a new line.
- Padding or borders added on top of
width: 100%withoutbox-sizing: border-box. - Elements pushed outside the screen with negative margins or absolute positioning, including some sliders and decorative shapes.
- Using
100vwfor a width. On some browsers it includes the scrollbar and ends up slightly wider than the visible page. - A missing or broken viewport tag. Read missing viewport meta tag if the page looks like a shrunken desktop site.
How to fix it in general
Once you know which element is too wide, match the fix to the cause. If you edit CSS, put it in your theme's custom CSS area, not in files that an update will overwrite.
For images, video and embeds:
img, video { max-width: 100%; height: auto; }
iframe { max-width: 100%; }
For padding that pushes boxes too wide (this applies to the whole site, so check your layout afterwards):
*, *::before, *::after { box-sizing: border-box; }
For long text or links:
p, li, a { overflow-wrap: anywhere; }
For wide tables, wrap the table in a container that scrolls on its own, so only the table slides and not the page:
.table-wrap { overflow-x: auto; }
For fixed widths, replace width: 800px with max-width: 100% or a percentage. For 100vw, use 100% instead.
You may be told to add overflow-x: hidden to the body. It does hide the sideways scroll, but it also hides content that is cut off, and it can interfere with sticky headers. Treat it as a last resort after you have fixed the real cause.
Fixes on common platforms
Menu names change between versions and themes, so look for the idea and not the exact label.
- WordPress: the cause is often a theme block, a page builder section or an embed with a fixed width. Custom CSS usually lives under Appearance, then Customize, then Additional CSS. Switching off one plugin or widget at a time shows which one is responsible. See the WordPress guide.
- Shopify: look at sections added by your theme or an app, and at images or videos with fixed sizes in the theme editor. Custom CSS is usually in the theme editor or the theme code. See the Shopify guide.
- Wix, Squarespace and Webflow: check the mobile view of the editor. Elements that are wider than the screen, or placed partly off the canvas, are the usual cause. Resize or move them in the mobile layout.
- Hand-built sites: use the console snippet above and fix the CSS of the elements it lists.
If a page builder or an installed app is the cause and you cannot change its width, contact its support or ask your developer to look.
How to confirm the fix worked
- Reload the page with a hard refresh, or clear your cache, so you are not seeing an old version.
- Repeat the phone test: drag the page left and right. It should only move up and down.
- Run the console snippet again. It should list nothing, or only elements hidden on purpose.
- Test in both portrait and landscape, and on at least one iPhone and one Android phone if you can. Safari on iPhone can behave differently from other browsers here.
- Check the other pages that use the same template or section.
How to stop it coming back
- Check your key pages on a real phone after every redesign, new plugin, new embed or theme update.
- Before pasting an embed code, look for a fixed
widthin it and replace it with100%if you can. - Resize images before uploading them. A huge image is easier to handle than one that must be squeezed.
- Put tables in scrolling containers from the start.
- Avoid
100vwand fixed pixel widths in custom CSS. - Keep a short list of the pages that matter most, and test those each time.
Small layout problems tend to appear one at a time. Related issues worth checking are text that is too small on mobile and form fields that are hard to tap.
Step by step for your platform
- Horizontal scrolling on mobile on WordPress
- Horizontal scrolling on mobile on Shopify
- Horizontal scrolling on mobile on Wix
- Horizontal scrolling on mobile on Squarespace
- Horizontal scrolling on mobile on Webflow
- Horizontal scrolling on mobile on Elementor
- Horizontal scrolling on mobile on WooCommerce
Questions
Why does my website scroll sideways on my phone but not on my computer?
A phone screen is much narrower, so an element that fits on a desktop can be wider than the phone. Fixed-width images, tables and embeds are the most common reasons.
Is adding overflow-x: hidden to the body a good fix?
It hides the symptom, but content that sticks out is then cut off and can be unreachable. Use it only after you have fixed or contained the element that is too wide.
Does horizontal scrolling hurt my Google ranking?
Google mostly looks at the mobile version of your pages, and a page that does not fit the screen is a poor mobile experience. It is not the only factor, but it is worth fixing.
How do I find which element is causing it?
Open the page in Chrome, press F12, switch to a phone size and run a short console snippet that lists elements wider than the screen. The code is in the checking section above.
Can a missing viewport tag cause this?
Yes. Without the viewport meta tag, phones show the page at desktop width and shrink it, which looks like a zoomed-out page that you can drag sideways.
Do I need a developer to fix this?
Often not. Resizing an image, wrapping a table or changing an embed width can be done in your editor. If it comes from your theme or a plugin, a developer can fix it quickly.