On this page
What this issue is
Every <img> tag can carry width and height attributes. They tell the browser the image's shape before the file has downloaded. Without them, the browser treats the image as 0 pixels tall, lays out the text, then pushes everything down when the file arrives.
Modern browsers use the two attributes to work out an aspect ratio (width divided by height) and reserve the right amount of space straight away. This works even when CSS scales the image to fit the screen.
Largest Contentful Paint (LCP) is the time until the biggest visible element, often a hero image, is drawn. Missing dimensions mostly hurt a different metric, Cumulative Layout Shift (CLS), but they also make the page do extra layout work and can make the hero render later than it should, particularly when the image sits inside a container that has no fixed height.
Why it costs you leads or sales
A page that jumps while loading feels unstable. A visitor about to tap a button or a form field may hit something else when the layout shifts. A hero that appears late makes a paid landing page look slow, and visitors from ads leave quickly.
- Page starts loadingHTML arrives, image size unknown
- Text and form drawnNo space reserved for the hero
- Image arrivesLayout reflows, content jumps
- Visitor taps buttonLands on the wrong element
- Lead form submittedVisitor gives up before this
The break happens when the image arrives and pushes the page down.
Example: illustrative CLS scores for one landing page. Google treats 0.1 or below as good.
How to check if your site has it
Run Lighthouse
In Chrome, open DevTools, go to the Lighthouse tab and run a mobile report. Look for 'Image elements do not have explicit width and height' and for the CLS score.
Use PageSpeed Insights
Test your landing page URL at pagespeed.web.dev. Check the 'Avoid large layout shifts' list to see which elements moved.
Record a Performance trace
In DevTools, open Performance, tick Screenshots, reload the page and look at the Layout Shifts track. Click a shift to see which image caused it.
Scan the HTML
View source and search for
<img. Any tag without bothwidth=andheight=is a candidate. Run this in the console to list them.
[...document.images]
.filter(i => !i.getAttribute('width') || !i.getAttribute('height'))
.forEach(i => console.log(i.currentSrc || i.src, i));How to fix it
Set width and height to the image's real pixel size (its intrinsic size), not the size it is shown at. Then let CSS make it fluid. The browser will use the ratio to reserve space at any screen width.
<img src="/img/hero.webp" width="1200" height="675" alt="Product on a desk">img {
max-width: 100%;
height: auto;
}Use the media library
Images inserted through the block editor or
wp_get_attachment_image()get width and height automatically. Re-insert images that were pasted in as raw HTML.Fix theme templates
In theme files, replace hard-coded
<img>tags withwp_get_attachment_image( $id, 'full' )or add the attributes by hand.Check page builders and plugins
Some builders and optimisation plugins strip or rewrite attributes. Test with the plugin off to find the cause.
Edit the theme code
In Online Store > Themes > Edit code, find
<imgtags orimage_taguse in your sections.Pass dimensions in Liquid
Use
image_tagwith width and height, or outputimage.widthandimage.height. Newer Online Store 2.0 themes usually do this already.
Check injected images
If a Custom HTML tag injects banners or images, add width and height to the HTML inside the tag. GTM itself does not change your page images.
Upload real images
Images added through the Image element normally output width and height. Check the element's settings in the Designer.
Check embeds
Add the attributes by hand to any image inside a custom Embed element.
Open the funnel or website builder
Select the image element and set its width and height in the element settings so a fixed box is reserved.
Edit custom code
In any Custom HTML or Code element, add
widthandheightto the<img>tags.
Use native image elements
Wix sets image box sizes in the editor. Avoid image sizes left on auto inside strips that have no fixed height, and set the size in the editor.
Check embedded code
Add the attributes to
<img>tags in any HTML embed.
Use Image blocks
Image blocks reserve space based on the uploaded file. Re-upload images that appear to load without a reserved box.
Check code blocks
Add width and height to any
<img>in Code blocks or code injection.
Add attributes in templates
Output the real width and height for each image from your CMS or build step.
Use aspect-ratio for CSS-sized boxes
If dimensions are unknown, set
aspect-ratio: 16 / 9;on the image or its wrapper.
Before
- <img src="hero.webp">
- Space is reserved only after download
- Text and buttons jump down
After
- <img src="hero.webp" width="1200" height="675">
- Space is reserved straight away
- Layout stays still while the image loads
How to confirm it's fixed
- The console snippet above lists no images on the page
- Lighthouse no longer reports missing width and height
- The Layout Shifts track in DevTools shows no shift from images
- CLS is 0.1 or below on mobile
- The page does not jump when you reload with the cache disabled and network throttled to Slow 4G
How to prevent it happening again
- Add width and height to image components in your theme or design system once, so every new image gets them
- Run a Lighthouse or PageSpeed check on each new landing page before it goes live
- Re-test after installing optimisation plugins or changing themes
- Tell editors to upload images through the media library, not paste raw HTML
- Review third-party widgets and banners that inject images
How FunnelGuard handles this
FunnelGuard does not check for missing image dimensions or layout shift today. It is a possible future check.
What FunnelGuard does do is run your real customer journeys on a schedule, such as lead forms and checkouts, and check each step, the tracking hits and whether test leads arrive. If a layout problem breaks a journey, for example a button that cannot be reached, a failed step can show up that way, with a screenshot. It will not tell you the cause is a missing image size.
To watch for this issue yourself, re-run PageSpeed Insights or Lighthouse on your key landing pages after each release, and check the Core Web Vitals report in Google Search Console, which groups URLs by CLS and LCP. You can also try the free plan (1 site, 2 journeys, daily checks, no card) for journey monitoring.
Questions people ask
Why do my images make the page jump while it loads?
The browser does not know how big an image is until it downloads, so it reserves no space. When the file arrives, the content below is pushed down. Adding width and height attributes lets the browser reserve the right space in advance.
Do I need width and height on every image?
Yes, on every <img> where you can. They matter most for images at the top of the page, but they cost nothing on others and prevent layout shift everywhere.
Do width and height attributes stop images being responsive?
No. Add img { max-width: 100%; height: auto; } in CSS and the image scales with its container. The browser uses the attributes only to calculate the aspect ratio and reserve space.
Do missing image dimensions slow down LCP?
They mainly cause layout shift, but they can also delay when the hero is painted, especially when its container has no fixed height. Fixing them is a low-effort step alongside compressing and prioritising the hero image.
What size should I put in width and height?
Use the intrinsic pixel size of the image file, for example 1200 and 675 for a 1200 by 675 image. The displayed size can differ because CSS scales it, as long as the ratio stays the same.
How do I find images without width and height?
Run Lighthouse in Chrome DevTools and look for the 'Image elements do not have explicit width and height' warning. You can also paste a short script in the console that lists images missing either attribute.
Can I use CSS aspect-ratio instead of width and height?
Yes. Setting aspect-ratio: 16 / 9; on the image or its wrapper reserves the space too. HTML attributes are still the simplest option because they work before any CSS loads.
Does FunnelGuard check for missing image dimensions?
Not yet. It is a possible future check. FunnelGuard currently monitors journeys, tracking hits and lead delivery, so use PageSpeed Insights or Search Console for this one.
Related issues
- PRF-001LCP over 2.5 s on a funnel stepFix guide
- PRF-002LCP over 4 s on mobile (poor) on the paid landing pageFix guide
- PRF-003Hero image is a 4 MB PNGFix guide
- PRF-004Hero image served at 3000 px wide to a 400 px phone screenFix guide
- PRF-005No srcset/sizes on responsive imagesFix guide
- PRF-007LCP image lazy-loaded (loading=lazy on hero)Fix guide