Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Images overflow container on mobile: how to find and fix it

PRF-174Medium impactCould addBy FunnelGuardPublished Updated
On this page

What this issue is

An image overflows when it is wider than the box it sits in. On a desktop the box is wide, so you may never notice. On a phone the box can be 320 to 430 px wide, and a 1200 px image does not shrink on its own unless your code tells it to.

Common causes are an <img> with width="1200" and no CSS limit, a fixed width in pixels set in a page builder, a background image or video embed with a fixed size, and a container with overflow: visible inside a narrow column. Images placed in a flex or grid item can also refuse to shrink because of the item's default minimum size.

Why it costs you leads or sales

Most visitors to ad landing pages arrive on a phone. An oversized image can cut off your headline, push the form off to the side, or make the whole page scroll sideways. People then see a page that looks broken and leave before they reach the button.

How an oversized image loses the lead
  1. Ad click on phoneVisitor lands on the page
  2. Hero image loadsWider than the screen
  3. Form or CTAPushed off screen or covered
  4. Lead or saleNever happens

The image breaks the layout, so the later steps are never reached.

Mobile conversion rate before and after the fixExample numbers
Mobile conversion rate before and after the fix (example)Image overflowing: 1.2 %; Image fixed: 2.4 %0121.22.4Image overflowingImage fixed%

Example: illustrative numbers only, showing how a layout that hides the CTA can lower mobile conversions.

How to check if your site has it

Find overflowing images
  1. Open device mode

    In Chrome, press F12, then Ctrl+Shift+M (Cmd+Shift+M on Mac). Pick a phone such as iPhone SE or set the width to 360 px.

  2. Look for sideways scroll or cut-off images

    Scroll the page. If it moves left and right, or an image runs past the edge, something is too wide.

  3. Find the culprit in the console

    Paste the snippet below into the Console. It lists every image wider than the screen.

  4. Test on a real phone

    Open the page on an actual iPhone and an Android device. Emulators miss some browser quirks.

List images wider than the viewportjavascript
[...document.images].filter(i => i.getBoundingClientRect().right > document.documentElement.clientWidth).forEach(i => console.log(i.currentSrc, i.getBoundingClientRect().width, i));

How to fix it

The core fix is the same everywhere: let the image shrink to fit its container and keep its shape.

Base rule for responsive imagescss
img {
  max-width: 100%;
  height: auto;
}

/* Flex or grid children that refuse to shrink */
.card, .column {
  min-width: 0;
}
Fix by platform
  1. Check the theme

    Most modern themes already set max-width on images. If one image overflows, open it in the editor and clear any fixed width in the block settings.

  2. Add the CSS

    Go to Appearance > Customize > Additional CSS and paste the base rule above.

  3. Check embeds and custom HTML

    Edit any Custom HTML block that has width="..." in pixels and replace it with style="max-width:100%;height:auto".

Image rules before and after

Overflowing

  • Image has width: 1200px
  • Page scrolls sideways on a phone
  • Form pushed off screen

Fixed

  • Image has max-width: 100%; height: auto
  • Image fits the screen
  • Form and button visible

How to confirm it's fixed

Confirmation checks
  • The page no longer scrolls sideways at 320, 360 and 430 px
  • The console snippet lists no images
  • The form and main button are fully visible
  • Images keep their shape and are not stretched
  • Checked on a real iPhone and Android phone
  • Checked in portrait and landscape

How to prevent it happening again

Habits that stop it coming back
  • Keep the global img { max-width: 100%; height: auto; } rule in your base styles
  • Preview every new landing page on a phone before publishing
  • Avoid pasting embed code with fixed pixel widths
  • Resize and compress images before upload
  • Retest after theme, plugin or page builder updates

How FunnelGuard handles this

FunnelGuard does not check for images overflowing their container yet. It is a possible future check. FunnelGuard does run your real journeys, such as lead forms and checkouts, on a schedule, and reports when a step fails, for example when a button cannot be clicked. A layout problem that stops a step from completing can show up that way, but this is not a layout check.

To watch for overflow yourself, test key pages on a phone after each change, and use Chrome DevTools device mode or Lighthouse. You can also start with the free read-only website audit, or the Free plan, to monitor one site and two journeys daily.

Questions people ask

Why is my image wider than the screen on mobile?

The image probably has a fixed width in pixels, or no max-width rule, so it stays at full size. Add max-width: 100%; height: auto; to your images and remove fixed widths.

Why is max-width 100% not working on my image?

A parent element may have a fixed width, or the image sits in a flex or grid item that will not shrink. Set min-width: 0 on that item and check for inline styles or !important rules that override yours.

How do I stop an image causing horizontal scroll on mobile?

Find the image wider than the viewport with DevTools, then set max-width: 100% and height: auto on it. Also check for embeds, videos and tables, which can cause the same problem.

Why is my image cut off on my phone but fine on desktop?

Desktop containers are wide enough for the full image, while phone containers are not. Without a size limit, the image runs past the edge and gets clipped. Responsive CSS fixes this.

Does overflow hidden fix an image that is too wide?

It hides the overflow, but it also cuts off part of the image and any content beside it. It is better to make the image shrink with max-width: 100%, and use overflow: hidden only where cropping is intended.

How do I fix images that overflow on WordPress or Shopify?

Add img { max-width: 100%; height: auto; } in Additional CSS on WordPress, or in your theme's CSS file on Shopify. Then clear any fixed widths set in blocks, sections or custom HTML.

Does FunnelGuard detect images overflowing on mobile?

No, not yet. It is a possible future check. FunnelGuard runs your real funnel journeys and reports failed steps, so test layouts by hand on a phone.

Does FunnelGuard catch this?

Could add

Not checked yet: could be added to FunnelGuard.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.