On this page
What this issue is
When a browser reads your HTML, it lays out the page before images have downloaded. If an <img> tag has no width and height, the browser doesn't know how much room to leave. It reserves nothing, then pushes the text and buttons below it down once the image arrives. That jump is called layout shift.
- HTML loadsBrowser lays out text and button
- Image has no size0 px of space reserved
- Image arrivesContent is pushed down
- Visitor tapsHits the wrong element
The image has no reserved space, so everything below it moves when it loads.
Why it costs you leads or sales
- Visitors tap the wrong link or button because it moved just as they touched it.
- A form or call-to-action jumps away while someone is reading or filling it in.
- Pages feel unstable, which lowers trust on checkout and lead pages.
- A poor CLS score is a small negative signal in Google's page experience data.
Example: illustrative scores for one page. Google rates a CLS of 0.1 or less as good.
How to check if your site has it
Run PageSpeed Insights
Open pagespeed.web.dev, enter the page URL and look for the audit 'Image elements do not have explicit width and height' and a CLS value in the report.
Use Chrome DevTools
Open DevTools, go to the Performance panel, record a page load and tick Layout Shifts in the Experience row. Click a shift to see which element moved.
Scan the HTML
View the page source and search for
<img. Any tag without bothwidth=andheight=is a candidate.Test on a slow connection
In DevTools Network panel, set throttling to Slow 4G and reload. Watch for jumps as images arrive.
How to fix it
<img src="/images/hero.jpg" alt="Team at work" width="1200" height="800">img {
max-width: 100%;
height: auto;
}
/* For images inside a fixed-ratio box */
.card-media {
aspect-ratio: 3 / 2;
}
.card-media img {
width: 100%;
height: 100%;
object-fit: cover;
}Update WordPress
WordPress adds width and height to images inserted through the editor automatically. Images in older posts, page builders or hard-coded theme templates may lack them.
Fix theme templates
Where a template prints an image, use
wp_get_attachment_image()orthe_post_thumbnail(), which output the dimensions. Avoid hand-written<img>tags without sizes.Check your page builder
In your builder's image settings, make sure the image isn't set to output without size. Also check any optimisation plugin settings that strip attributes.
Edit the theme code
In Online Store > Themes > Edit code, find
<imgtags orimage_tagfilters in your sections and snippets.Add dimensions
Use
{{ image | image_url: width: 1200 | image_tag }}, which outputs width and height. For hand-written tags, addwidth="{{ image.width }}" height="{{ image.height }}".
Check the image settings
Webflow adds width and height to images uploaded to the Designer. Select the image and confirm it isn't replaced by a custom embed.
Fix custom embeds
In any Embed element, add width and height attributes to the
<img>tags by hand.Fix background-style boxes
If a box loads its image late, give it a fixed aspect ratio in the Style panel (Size > Ratio).
Use native image elements
Wix sets the size of images placed in the editor. Layout shift usually comes from custom code or third-party apps, so check embeds first.
Fix HTML embeds
In any HTML embed, add width and height to every
<img>tag.
Use image blocks
Squarespace image blocks normally reserve space. Images added through Code Blocks or Code Injection may not.
Edit your code blocks
Add width and height to each
<img>, or wrap it in a container with a CSSaspect-ratio.
Add the attributes
Set
widthandheightto the image file's real pixel size on every<img>, including<picture>fallbacks.Add the CSS
Use
img { max-width: 100%; height: auto; }so the image scales while keeping its ratio.Handle iframes and embeds
Give videos and iframes an
aspect-ratiotoo, for exampleaspect-ratio: 16 / 9.
Before
- <img src="hero.jpg"> with no size
- No space reserved
- Text jumps when the image loads
After
- <img src="hero.jpg" width="1200" height="800">
- Space reserved from first paint
- Layout stays still
How to confirm it's fixed
- Re-run PageSpeed Insights and confirm the image dimension audit passes.
- Record a new Performance trace in DevTools and check there are no layout shifts from images.
- Reload on throttled Slow 4G and confirm nothing jumps.
- Test on mobile width, where images are scaled the most.
- Allow time for field data: Search Console's Core Web Vitals report uses real-user data collected over about 28 days.
How to prevent it happening again
- Make width and height a required part of your image component or template.
- Add the global
img { max-width: 100%; height: auto; }rule to your base CSS. - Reserve space for banners, embeds, ads and cookie bars with a fixed height or
aspect-ratio. - Check CLS after installing a new theme, plugin, popup or app.
- Set a CLS budget and monitor it on your key pages.
How FunnelGuard handles this
Questions people ask
Why does my page jump when images load?
The browser doesn't know the image's size until the file downloads, so it reserves no space. When the image arrives, the content below is pushed down. Adding width and height attributes or a CSS aspect-ratio reserves the space in advance.
Do I need width and height on every image?
Yes, for any image that loads in the page content. The attributes let the browser work out the aspect ratio before the file arrives. Images that are absolutely positioned or sit inside a box with a fixed aspect-ratio are less likely to shift.
Will width and height attributes break responsive images?
No. Set the attributes to the file's real pixel size and add img { max-width: 100%; height: auto; } in CSS. The image then scales to its container while the browser keeps the correct aspect ratio.
What is a good CLS score?
Google rates a Cumulative Layout Shift of 0.1 or less as good, 0.1 to 0.25 as needing improvement, and above 0.25 as poor. It is measured on real visits at the 75th percentile.
How do I find which image causes layout shift?
Open Chrome DevTools, record a trace in the Performance panel and enable Layout Shifts in the Experience row. Clicking a shift shows the moved elements. PageSpeed Insights also flags images without explicit dimensions.
Does CSS aspect-ratio replace width and height?
It can reserve the same space, and it works well for containers, embeds and background boxes. For plain <img> tags, width and height attributes are the simplest fix because browsers use them automatically.
Can FunnelGuard find images missing width and height?
Only partly. FunnelGuard checks a CLS budget on your pages and alerts you if layout shift goes over it. It doesn't list individual images without dimensions, so you still need PageSpeed Insights or DevTools to find them.
Do lazy-loaded images need width and height too?
Yes. Lazy loading delays the download, which makes reserved space more important. Without dimensions, each image that scrolls into view can push the content around it.