2

I know that the alt="" attribute is recommended for SEO propososes, but I also heard that put the description inside a div and hide with text-indent:-9999px or font-size:0; is a good practice for SEO.

So there is any difference between use:

<img alt="Descripition" />

or

<div style="background: url('path/to/img')>Description</div>"
  • What is you SEO goal? Do you want to rank the page in Google web search, or the image in Google image search? Or both? – Stephen Ostermiller Jul 27 '17 at 16:39
  • @StephenOstermiller to rank on the google web search.I've been question this when I was hiding a text from a logo, I thought "If I use the <img>, I'll have the description right on the tag and no need to put an text-indent. But must have an difference between an text inside a <div>," – LucasTelesx Jul 27 '17 at 16:57
  • 2
    Google reads your font-size:0 and thinks your are spamer:) Such technics is against guidelines - don't do it, not text-indent:-666, neither z-index:-666;. Write alt="" title="" - it should be enough. – Evgeniy Jul 27 '17 at 17:32
  • @Evgeniy and about the text-indent, if I want to rank a keywork on an bg image, What I should use for hide my text?... Use text-indent is also bad practice for SEO ? – LucasTelesx Jul 27 '17 at 17:39
  • 1
    There is no way to hide text and have it be used for SEO: support.google.com/webmasters/answer/66353?hl=en – Stephen Ostermiller Jul 27 '17 at 17:45
4

For images that you want to get crawled use the <img> tag with a well-written altattribute that describes the image.

For background images solely used for design use the CSS background-image.

As far I know CSS rules will not add value to your sites SEO but if CSS is used to hide contents from users and is only visible to search engines that might hurt your sites SEO.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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