Pew Pew Laser Blog

Code. Glass art. Games. Baking. Cats. From Seattle, Washington and various sundry satellite locations.

Pew Pew Laser Blog Archives — by Blog ID

Title Vs. Alt.

8.3.2011

Here is a summary of the intentions and key differences between the alt and title attributes for <img /> tags.

Alt:

The alt attribute is intended to be used instead of the image, rather than in addition to the image. It should describe all of the objects in the image. (Though technically incorrect, alt attributes are sometimes known as alt tags.)

The alt attribute is the text that should appear if the image doesn't load, or if visitor can't see image. The alt text may also appear in the image's place while the image is loading.

Include alt attributes for all images. For decorative images such as bullets or spacers, use an empty alt attribute (alt=""). (Of course, decorative images really ought to be part of the styling, not the content.) Don't use alt attributes for keyword stuffing.

IE6 will show the alt attribute when a visitor hovers over an image. Google uses an image's alt attribute when indexing images.

Title:

An image's title attribute should be used for additional, non-essential information.

In most browsers (IE7 and above, Firefox, Safari, et cetera), the title attribute will appear when the visitor hovers over the image.

Note that the title attribute can be used on many tags, not just images. For example, one good use of the title attribute is to add descriptive text about the destination on anchors / links.

Permalink

Tags: code html

Authorized users may log-in to leave a comment.

Last Blog: Quick Money.

Next Blog: Things I Bought Because of PAX.