The setup: good on desktop, poor on mobile
The site had already been through a CLS cleanup pass. Carousels had been fixed. Fonts were preloading correctly. Search Console was finally starting to show green across the board.
Except mobile wouldn't budge. Desktop: all good pages. Mobile: still flagged poor.
False lead #1: the marker that wasn't where I was looking
First stop was the Performance panel — reload-and-profile, not a plain refresh, to get a clean cold-start trace. The instinct was to look at the Experience track for the shift marker. Wrong track. The purple layout-shift indicator actually shows up in the Frames track, not Experience — a small distinction that costs real time if you don't know to look there.
False lead #2: the Cloudflare iframe
Next candidate looked promising: a Cloudflare bot-management iframe loading into the page. Suspicious-looking, third-party, easy to blame. It turned out to be a red herring — present, but not moving anything on the page. Ruled out and moved on.
The real culprit: carousels with unsized images
The actual shift traced back to carousels with unsized images across multiple template partials — familiar territory from earlier CLS work elsewhere on the site. The standard fix is well-worn at this point: add explicit width and height attributes to the <img> tags so the browser can reserve the right amount of space before the image loads.
Except this time, it didn't fully work. Desktop cleaned up fine. Mobile stayed stubbornly flagged.
The twist: when the aspect ratio itself is the problem
Testing at different browser widths surfaced the real issue: the aspect ratio of the images was changing as the viewport got narrower. That's not a missing-dimensions problem anymore — it's a design conflict. The carousel wanted a fixed-height thumbnail strip that stretched to fill variable-width columns responsively. That means the rendered aspect ratio was intentionally different from the source image's native ratio at every breakpoint. No single width/height attribute pair can correctly predict a box that's designed to change shape.
In other words: the "obvious" fix — the one that had worked everywhere else on the site — couldn't work here, because the box itself wasn't a fixed shape to begin with.
The fix: let the container own the space, not the image
The move was to stop relying on the image's intrinsic dimensions for space reservation and let the container reserve the space directly:
.image-overlay { position: relative; height: 155px; overflow: hidden; } .image-overlay img { width: 100%; height: 100%; object-fit: cover; }
Because .image-overlay gets an explicit height in CSS — not dependent on the image loading at all — the browser reserves that box immediately on layout, regardless of viewport width or when the image resolves. object-fit: cover keeps the same crop-to-fill look the site already had, just applied correctly. The inline width/height attributes and the old max-height styling on the <img> tag itself became unnecessary and came out entirely.
No dimensions on the tag anymore — and that's fine. The whole reason width/height attributes normally matter is so the browser can estimate an aspect ratio before it knows the image's real size. That only matters when the box size is otherwise unknown. Here, the box size isn't derived from the image at all — the container has a hardcoded height, and the image is told to fill it exactly. The browser knows the full box the instant it parses the CSS.
Same pattern slotted right into the existing per-carousel style block already handling the carouFredSel row-wrap fix — two new rules added alongside the ones already there. Tested with the same reload-and-profile method: layout shift score dropped to near-zero, on mobile this time too.
The tangent that wasn't one
Along the way, the Performance panel flagged a Long Task — "Evaluate script," tracing back to a Cloudflare challenge-platform script. Worth a glance, but it was a pre-existing, unrelated issue and not a CLS contributor. Correctly set aside rather than chased.
What actually changed this time
The interesting part of this story isn't really "here's how to fix CLS." It's the more useful one: what changes when troubleshooting stops being a slog and starts being a fast, guided loop.
CLS used to mean staring at a score with no idea where to start, then hours of trial and error before landing on an answer — if you landed on one at all. This round went image dimensions → mobile-only aspect-ratio mismatch → container-based fix, in one sitting, with a clear understanding of why at every step instead of just what to paste in. That's the difference: not just getting to the fix faster, but actually understanding the mechanism well enough to spot the same pattern anywhere else it shows up — any fixed-height, variable-width thumbnail strip on the rest of the site included.
When a client asks why conversions dipped on mobile, there's usually a reason sitting in exactly this kind of detail. The fewer mysteries there are in CLS, the faster that reason gets found — and fixed.