What Steps Can I Take to Ensure Consistent Image and Video Dimensions to Avoid "CLS Issue: More Than 0.1 (Mobile)" Problems?


To solve the 'CLS issue: more than 0.1 (mobile)' problem, it is critical to maintain consistent image and video dimensions on your site. This prevents layout shifts during the loading process, improves the website's performance, and enhances user experience. The steps include specifying dimensions for media elements, using CSS aspect-ratio property, and utilizing modern formats that support intrinsic sizing.

Specify Dimensions for Media Elements

Image Dimensions

Make sure to give your images width and height attributes. This allows the browser to allocate the necessary space while loading, preventing layout shift. For example, <img src="image.jpg" width="600" height="400">[Optimize CLS, 2020].

Video Dimensions

Like images, videos should have explicit width and height dimensions. Based on the video aspect ratio, assign the width and height attributes, e.g., <video width="320" height="240" controls>...</video> [HTML video Tag, 2021].

Use CSS Aspect-Ratio Property

The CSS `aspect-ratio` property is a modern approach to manage the dimensions of elements. It allows you to define a preferable width-to-height ratio for an element, preventing content layout shifts during the loading process [aspect-ratio - CSS, MDN Docs].

Utilize Modern Formats That Support Intrinsic Sizing

Modern image formats such as SVG, WebP, and JPEG XR support intrinsic sizing, meaning they can maintain their aspect ratio while scaling, helping to prevent unpredictable layout shifts [Understanding Native, Responsive Images, 2015].


Having a constant size for media elements is crucial for preventing layout shifts and improving website performance. By accurately specifying dimensions, using the CSS aspect-ratio property, and opting for modern, responsive formats, you can effectively resolve the 'CLS issue: more than 0.1 (mobile)'.