Titles and alts?

I know that alts only go on images, but how about titles please? Is this right ?

<a href=“http://www.websitename.com/websitepage” title=“Example”><img width=“312” height=“271” title=“Example” alt=“Example” src=“http://www.websitename.com/images/contents/homepage/imagename.jpg” /></a>

You can have a title attribute on <a>s and on <img>s, but there’s no point in having it on both at the same time (so far as I know). Best to choose one or the other.

Thanks, been all over the net on this, and can’t seem to find a definitive answer. Anyone know for sure?

title (HTML attribute)

Could you see the answer on there?

I’m not exactly sure what the question is. If it’s “can a title attribute be used on an image?”, then yes, indeed it can. That page lists elements that it can’t be shown on, which is kind of answering in reverse.

Thanks - the question is, can titles be used like in the code I posted above? ie, twice?

Oh. Hmm, the HTML validator seems to be OK with it. I just don’t think it’s very logical. But it certainly doesn’t seem to do any harm. Why do you want to place it in there twice anyway?

Just playing around with some ideas. Wonder if it would upset Mrs Google? Anyone know?

You can do that, but what’s the point? One title will override the other, it will only be shown once, and it will always be shown once. So you only need to include it once.

If your line of thought is that search engines are stupid enough to be fooled by a repeated title into going from thinking your site had nothing to do with those words to suddenly realising it’s the absolute best site for those words, think again.

Well, I think your title here is still an image not a text with H1 and H2 attribute. So, this means you are allowed to put alt tags just to identify that it is the name of your websites, but google will place your title which is image on to their image database.

Alt tags will carry the keywords for you in the images so it’s better that you use the remaining in the links with the title tags.

Like Stevie said the title on the anchor will be used if you hover on it. However a screen reader will read the alt attribute as a link. The double title may look like keyword stuffing.

Welciome_alexray’s suggestion is incorrect. Do not stuff alt tags with keywords.

I would suggest using alt tags with images and title tags for your links. And when using title tags with link, don’t use the same text that you use as anchor text as title tag. It look spammy in that fashion

You need to at least specify an empty title attribute on your images so as to fix a bug in IE when it sees images that don’t have a title attribute. IE incorrectly copies the alt attribute into the title attribute if the title is missing.