All Collections
Troubleshooting
PageSpeed Scores
How to Fix “Image elements do not have explicit width and height” with NitroPack
How to Fix “Image elements do not have explicit width and height” with NitroPack
Updated over a week ago

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 Cache Settings > Images & Media > Image Lazy Loading.


When you apply the changes, don’t forget to purge the cache afterwards so they can take place.

You can do it from your Dashboard:

📌 If you need any assistance or have questions, reach out to our support team at [email protected] or via this link: https://support.nitropack.io

Did this answer your question?