1

Say I have this html code (replace x and y with actual numbers):

<html>
  <head>
    <style>
    IMG {width: 100%;height: auto; max-width:xpx; max-height:ypx;}
    </style>
  </head>
  <body>
    <img src="image.jpg" width=x height=y>
  </body>
</html>

It automatically sizes the image based on the user's screen size if the screen size is smaller than x by y pixels. Would google's bot recognize the css and believe I'm sizing the image properly or does it not have enough intelligence to do that and just downright assume the image is x by y pixels no matter what?

I'm asking because I don't want to run into any penalties about width being too large especially on my mobile site.

7
  • 1
    It should. Does the Fetch as Google and Render then the Mobility Test Tool give you what you expect?
    – closetnoc
    Oct 25, 2015 at 17:26
  • I'll try and see, but since google has so many different bots that can scan a site, one google bot could have different capabilities compared to another google bot. Oct 25, 2015 at 17:30
  • Actually, all the bots are the same bot and do the same work, it is just that they are labeled differently depending upon what system put the request into the queue. Some of the post processing differs, but the core processes are the same. This save in bandwidth and duplicate requests.
    – closetnoc
    Oct 25, 2015 at 17:57
  • 2
    The more time you spend worrying about Google penalties (Which, does not penalise for not using height/width)... the more time you lose actually increasing your rankings through not spending time on actual things that make a real difference, i.e content. Google does not penalise for not using widths on images, and even desktop images can work just fine on most 2-3 years old mobiles just fine. if your worried about rendering issues then use a pre-loader with fixed width and height using JS. Or dymanicly serve different versions of your images, again, width and height is not needed. Oct 25, 2015 at 18:08
  • 3
    Bottom line is, you can spend a million years optimising your content and it can rank badly, The importance of on page seo optimisation is by far less than you think. Disclaimer (short article I wrote a few days back). Markup, plays little role to no-role in actual rankings and even user experience is not as weighted as you would like it. External influences is the biggest factor and trumps any optimisation by huge margins! Oct 25, 2015 at 18:08

1 Answer 1

1

I agree with all the comments made about SEO being to highly focused on over other webmastering tasks however in answer to your question...

As long as you do not have any robots.txt rules which block access to your CSS, or the CSS in question is on the page or inline you won't have any issues. Putting aside concerns of penalties, which would not happen under these circumstances, Google has for a long time now been able to effectively see the page as a end user would thanks to the fact that the bots use any discovered CSS and javascript in the indexing process. So if you have CSS which resizes an image the Googlebot will detect this and treat the image being displayed in the browser as the size set in CSS.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.