Title tag or just Src

If I have a photo should title be used as an attribute with it or is the src attribute enough? This should be an easy answer to search out but I cannot get a definitive answer on any HTML site.

  • Title doesn’t show up in the display portion, so to make it a title, it should be the first element on the page. Being in the <body> tag. Let me know if I understood your inquiry.

This might be a better example. Which is best or correct?

<img src=“photo1” alt=“A great photo example”>

or

<img src=“photo1” alt=“A great photo example” title=“A great photo example”>

Sorry, I typed src in the original post when I meant alt.

The alt attribute should convey the same information, if any, as the image does in that particular context. It will be shown when the image cannot be shown.

The title attribute can be used to show non-critical information in relation to the image. It should probably never be the same value as the alt (unless both are empty).

Thanks for clearing that up. Have a good day.

One more thing is that there is a bug in Internet Explorer where if you don’t specify a title then it creates one with the content of the alt attribute. So if you want consistent results across all browsers you should always specify a title even if you specify title=“” in order to tell IE that there isn’t one.

You’ll be happy to learn that this bug has been eliminated in Internet Explorer 8 :slight_smile:

So once everyone using IE is using version 8 or later it will not be necessary to always supply a title attribute but while there are still lots of IE6 and 7 users it is still necessary to use the title attribute to work around the bug in those browsers.

Using title is always good for SEO:cool:

To be honest I liked that bug in IE…sometimes reading the ALT was the only way to actually tell what action clicking on a certain image does. Referring to UI where the developer was to lazy to label thing except with images.

You can get that exact behaviour in ALL browsers if that is what you want simply by setting the title attribute.

Right…but I don’t control the source code to do that in the various UIs I’ve ran into with that problem.

No it isn’t. The title attribute isn’t even indexed by search engines.

Thanks for the help and the discourse taking place. All the post here regard questions and concerns I had after doing a search on the title attribute.