On my website, I have a variety of images in different sizes that adjust responsively to the browser width. However, Google Search Console indicates that there is a significant CLS issue with a shift time of .25s due to the layout moving as the images load.
Given that the images are responsive, it's challenging to set specific dimensions or placeholders to reserve space for them.
Is there a modern approach to addressing CLS concerns with responsive images?
Check out the layout here: https://jsfiddle.net/exspwgab/
Update: To tackle this problem, I attempted a technique found online which involves specifying the image file's width and height within the img tag like this:
<img src="photo.jpg" width="1504" height="752">
Additionally, I applied the following CSS properties:
width: 100%;
height: auto;
However, this method didn't provide the desired results and the webpage elements continued to shuffle during image loading.
If anyone knows of a solution that works across all browsers, please share it with me. I require placeholders to maintain space integrity while images load, in order to avoid any jarring effects on the page.
For reference, here is a JSFiddle showcasing my responsive layout: https://jsfiddle.net/exspwgab/