I was told that specifying inline width and height for all images will be good for SEO and also helps the site loads faster, like so:
<img src="http://www.example.com/images/free-size.jpg" width="200" height="400" alt="random image" />
Although I can still overwrite the inline setting using height:auto;. So that images re-size properly when in different display platforms.
But just before I go ahead and doing this just want to reassure if these statements are true. Personally I feel dubious about fixing the inline dimension and overwriting using external CSS, just sound a bit hacky to me.....
Choosing the right image formats, sizes and dimensionsImage file size can disproportionally affect page load time so it's important to get it right. JPEGs are usually more SEO-friendly than PNGs, especially if you do not need transparent backgrounds, as they offer better compression levels.
Thanks to some recent changes in browsers, it's now well worth setting width and height attributes on your images to prevent layout shifts and improve the experience of your site visitors.
Keep in mind that large images are more likely to be featured in Google Discover. As Google recommends in its Advanced SEO resource, “Large images need to be at least 1200 px wide and enabled by the max-image-preview:large setting, or by using AMP.”
The height and width of an image can be set using height and width attribute. The height and width can be set in terms of pixels. The <img> height attribute is used to set the height of the image in pixels. The <img> width attribute is used to set the width of the image in pixels.
I was told that specifying inline width and height for all images will be good for SEO and also helps the site load faster.
Yes. This has traditionally been true (at least the "site loads faster" part).
By specifying the height and width attributes of an <img>
the browser reserves a space matching those dimensions for the image while it continues parsing the rest of the HTML document. Then when the browser loads the image, the reserved space is waiting and there is no need to reflow the document.
Providing this sizing data results in a faster rendering process.
In contrast, if the width and height attributes are omitted, the browser will not know the size of the image until the download is complete, which forces the browser to reflow the document, slowing down the rendering process.
Now imagine a page with 50 images with no defined width and height attributes. The performance hit could be very noticeable.
The practice above represents the traditional view of image loading.
In contrast, some people are now saying that for responsive design the width and height attributes should be avoided.
Responsive Design does not normally use any width or height attributes
The majority of responsive websites do not use width or height because they want the images to adapt to the screen size and by using fixed width and height using
<img>
which would dampen user experience and Google has declared this one of the most important factors.source: https://webmasters.stackexchange.com/a/68494
So there are arguments on both sides and the decision most likely depends on your individual case. As you make your decision here are some more details:
I was told that specifying inline width and height for all images will be good for SEO and also helps the site loads faster.
No, it does help loading the site faster. It helps avoid flickering when rendering the page. If you want to load your images faster, make sure they have the same size as specified in the page and use a service like kraken.io to reduce the corresponding file size.
About SEO, it's improper image size and width for the screen size that can hurt your SEO. Google may consider you site as not user-friendly and/or not smartphone friendly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With