How to Fix “Image elements do not have explicit width and height” with NitroPack

The “Image elements do not have explicit width and height”  warning might appear in the Google PSI report when you are testing your website:

NitroPack does not add explicit width and height to images to avoid compatibility issues with different galleries and carousels.

What it does instead is to set a placeholder SVG with the same size as the original image so that galleries and carousels can be initialized correctly and the containers can be resized as the original images.

Our “Size images preemptively” feature assist by ensuring all images get explicit width and height before they are loaded with the above solution, but our current method is not detected by Google PSI.

The feature is enabled by default in our Medium, Strong, or Ludicrous optimization modes. In case you’re using the Custom mode, you can enable it by going to > Images > Automatic Image Lazy Loading.

When making changes in the Dashboard, don’t forget to purge the cache afterward so changes can take place.

You can do so under the Cache Status tab in your NitroPack dashboard:

📌 If you need any assistance or have questions, reach out to our support team at or via this link:

Was this article helpful?
0 out of 0 found this helpful



Please sign in to leave a comment.