Specify Image Dimensions

The Importance of Specifying Image Dimensions

This optimization message is like the optimize images section we talked about earlier in this guide. In addition to making sure your images are sized correctly, specifying the size/dimensions (width and height) of your images within the CSS or HTML will help load your web pages load faster. When a user lands on your page, the browser begins the process of checking the position of text and images and uses this information to build the page. If the image dimensions are not specified, the browser will only allocate the necessary space based on the size of the container the image is in or the image itself.

The browser will then work on processing the text and then go back to working on the images and rendering them. You may notice this more on mobile devices where these layout shifts occur as the content loads. And this is where the performance bottlenecks can take place, especially if there are a lot of images that are missing these important attributes. These layout shifts cause the page to load slower and delay the time it takes for a user to begin interacting with it.

lighthouse

Lighthouse

Lighthouse is an open-source tool that is used to run an audit against your web pages and provides scores and suggestions for improving page performance, accessibility, SEO, and more.

pagespeed

PageSpeed Terms

PageSpeed Insights is a tool created by Google that reports on the performance of a page on both mobile and desktop devices, and provides suggestions on how that page may be improved.

yslow

YSlow

YSlow is an open-source website analysis tool that can be used to identify web page performance issues. Learn more about the YSlow to enhance your web pages and the user experience.