Is there a reason to put a title attribute on an image (img tag) if this is inside a link (a tag) already with a title ? (said that you already put the alt attribute to the img tag)


1 Answer 1

<a href="https://www.google.com" title="Hey Google Title"><img alt="Hey image alt" title="Hey image title" src="https://i.stack.imgur.com/k7vzy.png"/></a>

In above example, image title is win, but if you remove the image title tag and use only anchor title as you said in your question, then browser will pick up anchor title when someone hover the image.

I don't know why you're implementing title tag, if it is for screen reader then make sure it good written and not picked automatically from title or heading. if it is for regular user, then it is just unnecessary, I rarely see people, who hover on images to read some text.

The text around images is also enoguh to understand about the images for search engine. Quora website index/ranking for many of photos in image search without using alt and title attribute.

  • the purpose is mainly for seo optimization
    – Gulp
    Dec 5, 2016 at 8:43
  • If there is alt text then you don't need title tag for SEO.
    – Goyllo
    Dec 5, 2016 at 11:49
  • Just for curiosity: how to know this in detail ? Say that google (and other engines) behaviour is not obvious and not clearly explained, how to know that I can avoid title if already is present alt attribute ?
    – Gulp
    Dec 5, 2016 at 15:06
  • Whenever I watch any official webmaster hangout of john muller, he always said about alt text for images, never talk about title tag. The official docs also not talk about the title tag. And alt is used widely compare to title tag, so it make sense they will give priority to that tag, because it is just used to know about the images. For better UX, webmaster can now use picture and caption element as well.
    – Goyllo
    Dec 5, 2016 at 15:27

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.