Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SEO impact on specifying image width and height for responsive website?

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.....

like image 325
Vincent1989 Avatar asked Aug 26 '15 04:08

Vincent1989


People also ask

Does image size affect SEO?

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.

What is the advantage if you specify the height and width of the image?

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.

What size should images be for SEO?

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.”

Can we specify the width and height of an image in a Web page?

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.


2 Answers

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:

  • Specifying image dimensions to improve browser performance
  • Image width/height as an attribute or in CSS?
like image 191
Michael Benjamin Avatar answered Sep 28 '22 07:09

Michael Benjamin


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.

like image 40
Jérôme Verstrynge Avatar answered Sep 28 '22 07:09

Jérôme Verstrynge