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" />


<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? Jul 27, 2017 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>," Jul 27, 2017 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, 2017 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 ? Jul 27, 2017 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 Jul 27, 2017 at 17:45

1 Answer 1


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.

  • It's also important to note that google wont include background images in search results Oct 23, 2020 at 15:20

Your Answer

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

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