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.
- Ad click on phoneVisitor lands on the page
- Hero image loadsWider than the screen
- Form or CTAPushed off screen or covered
- Lead or saleNever happens
The image breaks the layout, so the later steps are never reached.
Example: illustrative numbers only, showing how a layout that hides the CTA can lower mobile conversions.
How to check if your site has it
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.
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.
Find the culprit in the console
Paste the snippet below into the Console. It lists every image wider than the screen.
Test on a real phone
Open the page on an actual iPhone and an Android device. Emulators miss some browser quirks.
[...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.
img {
max-width: 100%;
height: auto;
}
/* Flex or grid children that refuse to shrink */
.card, .column {
min-width: 0;
}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.
Add the CSS
Go to Appearance > Customize > Additional CSS and paste the base rule above.
Check embeds and custom HTML
Edit any Custom HTML block that has
width="..."in pixels and replace it withstyle="max-width:100%;height:auto".
Open the theme code
Go to Online Store > Themes > Edit code and open your main CSS file in Assets (name varies by theme).
Add the base rule
Add the CSS above, then review sections that output images with a fixed
widthattribute in Liquid.Use image_url with a width
Output images with the
image_tagfilter and awidthslist so the browser picks a size that fits.
Select the image
In the Designer, pick the image and open the Style panel.
Set size
Set Width to Auto and Max Width to 100%. Remove fixed pixel widths on the tablet and mobile breakpoints.
Check the parent
Make sure the parent div has no fixed width and that flex children have a sensible size.
Open the mobile editor
Switch to the mobile view in the Wix Editor, where the layout is edited separately.
Resize the image
Drag the image inside the screen margins and align it to the grid.
Check custom embeds
For HTML embeds, add
max-width:100%to the content inside.
Add custom CSS
Go to Website > Website Tools > Custom CSS and paste the base rule.
Check code blocks
In any Code Block, replace fixed pixel widths on images with
max-width:100%.Preview on mobile
Use the mobile preview icon in the editor and test the published page on a phone.
Open the page builder
Select the image element and switch to the mobile view.
Set width
Change width from a fixed pixel value to a percentage or Auto, and check the section padding.
Add custom CSS if needed
Under the page's custom code settings, add the base rule. Where it goes depends on your builder version.
Add the base rule
Put the CSS in your main stylesheet and make sure the viewport meta tag is present.
Use srcset and sizes
Serve smaller files to phones, for example
<img src="a-800.jpg" srcset="a-480.jpg 480w, a-800.jpg 800w, a-1200.jpg 1200w" sizes="100vw" alt="...">.Remove fixed widths
Delete inline
widthstyles in pixels that are larger than a phone screen. Keep thewidthandheightattributes so the browser reserves space.
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
- 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
- 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.
Related issues
- PRF-154Horizontal scroll / content wider than viewport on mobileFix guide
- PRF-173Tables overflow on mobileFix guide
- PRF-160Missing viewport meta tag (desktop page shrunk on phones)Fix guide
- PRF-177Layout broken on small phones (320-360 px)Fix guide
- PRF-171Content hidden on mobile (display:none) including the form or CTAFix guide
- PRF-155Main CTA below the fold on mobileFix guide