Content Exceeds Viewport

No Comments
Content exceeds viewport

Element Code: HT-023

TL;DR: Content exceeds viewport means something on the page is wider than the screen, forcing horizontal scroll on mobile. It is almost always one fixed-width element: an image, a table, an embed, or a rogue 100vw. Find the overflowing element in Chrome DevTools, cap it with max-width, and the problem is gone.
Severity
Medium
Affects
Mobile UX, page experience
Root cause
Fixed-width CSS or media
Detection
DevTools, Lighthouse
Fix effort
Minutes per template

What this issue actually is

The viewport is the visible area of the browser window. On a phone that is typically 360 to 430 CSS pixels wide. "Content exceeds viewport" means at least one element on the page renders wider than that, so the browser grows the horizontal scroll area and users have to pan sideways to read or, worse, the layout just looks broken with text running off the edge.

This is a layout defect, not a content problem. The page has a responsive design that mostly works, and then one element ignores it: a 1200px product comparison table, an infographic exported at fixed width, an iframe embed with hardcoded dimensions, or a CSS rule someone wrote at a desk on a 27 inch monitor. The rest of the page squeezes down politely and this one element blows out the layout for everyone on a phone.

Lighthouse tests for this directly with its "content is sized correctly for the viewport" audit, which compares the width of the rendered content against the viewport size. If window.innerWidth and the document's scrollWidth disagree, you fail.

Why it matters for SEO

Google has indexed the mobile rendering of your pages since mobile-first indexing rolled out to effectively all sites (Google completed the transition in 2023). Googlebot smartphone renders your page at a mobile viewport, so an overflow problem exists in the exact rendering Google evaluates. Mobile usability sits inside the broader page experience picture, and while nobody can show you a dial that says "horizontal scroll costs X positions," the second-order effects are real: users bounce off pages they have to pan sideways to read, and engagement signals on a page like that are ugly.

Worth knowing: Google retired the standalone Mobile-Friendly Test tool and the Mobile Usability report in Search Console in late 2023. Plenty of older articles still tell you to check those. They are gone. Lighthouse and Chrome DevTools are the replacements, and honestly they were always better because they show you the offending element instead of just waving a flag.

There is also a pure rendering-budget argument. A page that lays out cleanly at mobile width is a page where Google's renderer, your CSS, and your users all agree on what the page looks like. Every divergence between what you built and what renders is a place for bugs to hide.

What overflow looks like

BEFORE: fixed 700px table width:700px overflow AFTER: max-width:100% fits, no horizontal scroll user must pan sideways

How to find the offending element

The fastest diagnostic is a two-line console check. Open the page on a mobile viewport in Chrome DevTools (device toolbar, pick any phone preset) and run:

document.documentElement.scrollWidth > window.innerWidth
// true means something overflows. Then hunt it:
[...document.querySelectorAll('*')].filter(el => el.scrollWidth > document.documentElement.clientWidth)

That second line lists every element wider than the viewport. The outermost one in the list is usually your culprit; everything inside it is collateral.

For coverage at scale:

  • Lighthouse: run it mobile, check the "content is sized correctly for the viewport" audit under SEO or Best Practices depending on version.
  • Screaming Frog with Lighthouse integration: connect the PageSpeed Insights API under Config, crawl the site, and filter for viewport failures. This is how you find out the problem lives in one template rather than one page.
  • Real devices: emulators miss scrollbar-width quirks. A quick pass on an actual phone, or BrowserStack if you need specific models, catches the 100vw class of bugs that only appear when a scrollbar consumes width.

The usual suspects and their fixes

CauseWhy it overflowsFix
Images with fixed dimensionswidth attribute or CSS wider than the screenimg{max-width:100%;height:auto}
Wide tablesMany columns cannot compress below content widthWrap in a div with overflow-x:auto so the table scrolls, not the page
100vw elements100vw includes the scrollbar width, so it is wider than the visible areaUse width:100%, or 100vw with overflow-x:clip on the parent
Iframes and embedsThird party snippets ship hardcoded widthResponsive wrapper with aspect-ratio and max-width:100%
Long unbroken stringsURLs or code that cannot wrap push their container wideoverflow-wrap:anywhere, or overflow-x:auto on pre blocks
Negative margins, absolute positioningElements deliberately placed beyond the edgeContain with overflow-x:clip on the section, or rework the offset
Flex or grid childrenDefault min-width:auto stops children shrinking below content sizeSet min-width:0 on the child, or minmax(0,1fr) in grid tracks

One thing I want to flag because I see the lazy version constantly: slapping overflow-x:hidden on the body. Yes, it kills the scrollbar and the audit passes. It also means the overflowing element is now clipped, with whatever content lived in that zone amputated for mobile users. Fix the element, not the symptom. Hidden overflow on the body is the CSS equivalent of putting tape over the check engine light.

Also confirm the basics before touching CSS: the page needs <meta name="viewport" content="width=device-width, initial-scale=1"> in the head. Without it, mobile browsers render the page at a fake desktop width and zoom out, which produces a related but different failure.

What good looks like

At any viewport from 320px up, the document's scrollWidth equals the window's innerWidth. No element in the DOM is wider than the screen. Tables and code blocks that are legitimately wide scroll inside their own container while the page itself stays put. Text wraps, images scale, and nothing requires sideways panning to read. Run the console check above on your key templates at 360px and 320px; when both return false, ship it.

DO

  • Set max-width:100% on images, video, and embeds globally
  • Wrap wide tables in an overflow-x:auto container
  • Test at 320px and 360px, not just the iPhone preset you like
  • Fix the template, then recheck every page type using it
  • Keep the viewport meta tag on every page
DON'T

  • Hide the problem with overflow-x:hidden on the body
  • Use 100vw for full-width sections without handling scrollbar width
  • Hardcode pixel widths on containers in content areas
  • Trust desktop DevTools emulation alone for scrollbar-related bugs
  • Rely on retired tools: the Mobile-Friendly Test and GSC Mobile Usability report are gone

FAQ

Does horizontal overflow directly hurt rankings?
Not as a labeled penalty. It degrades the mobile experience Google renders and users react to, and it fails the Lighthouse viewport audit. Treat it as a real defect with indirect ranking exposure, not a myth and not a catastrophe.
Where do I check this now that the Mobile-Friendly Test is dead?
Chrome DevTools device mode for single pages, Lighthouse for the audit verdict, and Screaming Frog with the PageSpeed Insights API connected for sitewide coverage. Google removed the standalone test tool and the Search Console Mobile Usability report in late 2023.
Is it acceptable for a data table to scroll horizontally?
Yes, when the scrolling happens inside the table's own wrapper and the rest of the page stays fixed. A genuinely wide dataset scrolling in place is good UX. The whole page dragging sideways is the failure.
Why does my page only overflow on some phones?
Different devices have different CSS viewport widths, and an element fixed at, say, 400px overflows a 360px screen but fits a 428px one. Test at 320px, the practical floor, and you cover everything above it.
The overflow only appears when a cookie banner or chat widget loads. Whose fault is that?
The third party ships the fixed width, but it renders on your domain, so it is your problem. Constrain the widget's container with max-width and overflow rules on your side, and file a ticket with the vendor anyway.
Want every template on your site checked at mobile widths?

An advanced audit renders your key pages the way Googlebot smartphone does and flags every layout, speed, and crawl defect with a prioritized fix list.

Get an Advanced SEO Audit

Claude Vincent is a technical SEO consultant focused on crawlability, rendering, and AI-search visibility. He writes the field guides and case studies at SEO ProCheck, with a bias toward the durable, unglamorous work that decides whether search engines and AI answer engines can actually read and cite a site.

About SEO ProCheck

Technical SEO consulting and GEO strategy with 20 years of enterprise experience. Case studies, resources, and tools for search and AI visibility.

Work With Me

Technical SEO audits, GEO strategy, site migrations, and international SEO. Hourly consulting for teams who need hands-on support, not just reports.

Subscribe to our newsletter!

More from our blog