Magento 2: Set an explicit width and height on image elements to reduce layout shifts and improve CLS?

When I run my site through it shows this error: enter image description here

I have already added image height and width in my view.xml and I also ran catalog:images:resize command but it didnt fix the issue. How can I fix this?

Answers 1

  • Expand this error and check it. You need to set height & width attribute with it's value in <img> tag.

    For ex :

    <img class="product-image-photo" src="" width="240" height="300" alt="Push It Messenger Bag">

Related Questions