Use "ALT" or "TITLE" Which one?

Just curious, should I use “ALT” or “TITLE” for text links? I have been wondering this for a while now and how much does it really improve your search engine results?

Thanks. Currently, I am not using either one…is that a bad thing? In other words, does it really matter anymore if I use the “ALT” or “TITLE” tags?

Ryan

The alt attribute provides alternative text in place of images where the person visiting the page can’t see the image either because they have images turned off or are using a browser that can’t display images.

The title attribute provides additional discriptive text to be displayed either as a tooltip or in the status bar (depending on the browser) when the mouse is hovered over the tag it is attached to.

The two attributes have nothing whatever in common and so there should be no reason for confusing the two. The only reason the two are sometimes confused is due to a bug in some versions of Internet Explorer where images that do not have a title attribute have one generated by the browser with the same content as is in the alt attribute.

Yep what Stephen said!
I made a rule about those attributes for my Designers / Developpers :

  • the alt attribute is mandatory and one shouldn’t even leave it empty!
  • the title attribute is strongly advised to use (…and could be useful for SEO!)

There are a few occasions where you should leave the alt attribute empty, i.e. alt=“” If it would contain “irrelevant alternate text” if the image was purely for decoration; mainly for the benefit of text to speech output - but the alt attribute is mandatory on IMG.

nice answers guys, wondering something similar myself.

So in conclusion whatd should the OP use for his text links…?

:confused: Post #2

Nobody said that alt is also an invalid attribute for links. yes Stephen said you use it for images, but nobody said alt is ONLY for images. Title may be ok for SEO, but you cannot keyword bait it.

The alt attribute is to provide alternate text to display in place of images when the image itself can’t display. It is not valid for any tag other than images since you can’t provide alternate text to display in place of an image when there is no image there to display it as an alternative to.

The only time the alt text is used is when the browser is unable to display the image it is an alternative for.

The only exception to this is due to a bug in Internet Explorer where if you do not include a title attribute on images then IE will create one for you copying the alt attribute content. The fix for this is to ALWAYS include a title attribute on images and make it empty if you don’t want to have anything display in a tooltip/status bar.

My advice is to use both of the attributes. In terms of SEO they both matter

Exactly. Just as a comb and a razor are both useful for doing your hair. Each do completely different things.

Also by always adding a title attribute to your images you force IE to work the same way as other browsers do with respect to the tooltips associated with the image.

Properly used the alt attribute can no more substitute for the title attribute than a razor can substitute for a comb (and the same is true the other way around).

very helpful information, one more thing to clear. for example in a corporate website i have placed an image of the company’s director in director’s message section. exactly what should i put in Alt attribute and what should be in TITLE? will both have same text?

The alt is MANDATORY as that’s what those who can’t see the image will get instead. The title is optional but if you leave it out then Internet Explorer will copy the alt so if you really want to leave it off an image then specify title=“”

Thanks for your help with this everyone, you guys are a great help as always!

very helpful information, one more thing to clear. for example in a corporate website i have placed an image of the company’s director in director’s message section. exactly what should i put in Alt attribute and what should be in TITLE? will both have same text?

…was wondering the same thing because this is currently what I’m doing. Also, should I add “ALT” tags to text links too or just keep it as a “TITLE” tag?

With the corporate site you do not repeat the ‘alt’ value with the ‘title’ attribute they both differ. The ‘alt’ attribute is mainly to describe functionality of the image. An example of the ‘alt’ might be: alt=“Welcome to Frobozz Electric Corp” Whereas the ‘title’ attribute is typically used to briefly describe the contents of the link.

Like was mention several dozen times; you cannot add an ‘alt’ attribute to a standard text link but it must be used for an IMG element, e.g. <img src=“example.png” alt=“dummy text” />

My advice is to use both of the attributes. In terms of SEO they both matter

Not at the same time.

Images should not have titles.

Links should not (cannot) have alt attributes.

Titles should not repeat link text.

This is evil:
<a href=“somewhere” title=“About us”>About us</a>

Don’t do it.

Titles should not be used as image captions. If you need a caption, put real text underneath or around the image so everyone can read it.

This is generally also not a good thing:
<a href=“somewhere” title=“About us”><img src=“j3kl2j4h.gif” width=“40” height=“40” alt=“About us”></a>

Keep titles out in this situation. Use titles only for when you must hide some additional information which is not necessary or important, since title text only appears to the user if they have a mouse and mouse over the element. Plenty of people don’t have mice. Plenty of mobile devices don’t have pointers (which act like mice). For <abbr> tags this means you should explain the abbreviation in plain text beforehand, so everyone can read it.

In dropdown menus titles may cause usability problems by the tooltips getting in the way/covering up the submenu’s links.

To fix the bug in Internet Explorer you need to add title=“” to images that you don’t want to have a title as otherwise IE copies the alt text and generates a title with the same content as the alt.

Yes I’ll agree with an empty title when it’s a problem in IE. Although I happen to know a lot of people who are IE-only users who have learned to rely on that information as confirmation of… something. So most of the time I leave title out there as well.

Well in that case shouldn’t there be a title attribute with the same value as the alt attribute so that everyone sees it and not just those using IE.

I use titles basically as a tool tip.

a typical situation is having a table of products/categories, or whatver, with one of the columns being a button or link to take you to the edit form for that item.

 
echo '<a href="editProductForm.php?txtProdId='.$prodId.'" title="Edit '.$prodId.'" >Edit</a>';

On hovering over the link the user then gets a confirmation tooltip showing the prodId that will be edited if the link is clicked.

I use alt in <img>s because in at least xhtml strict they are mandatory and also if the image is not available for some reason the user sees the alt text. Screen readers also use the alt text.