Sams Teach Yourself HTML 4 in 24 Hours

Sams Teach Yourself HTML 4 in 24 Hours

By Dick Oliver

Labeling an Image

Each <img /> tag in Figure 10.1 includes a short text message, such as alt="Friendly Fen". The alt stands for alternate text because this message will appear in place of the image in older Web browsers that don't display graphics, or for those users who choose to turn off automatic image downloading in their Web browser preferences.

People who are using the latest Web browser software will see the message you put in the alt attribute, too. Because graphics files sometimes take a while to transfer over the Internet, most Web browsers show the text on a page first with the alt messages in place of the graphics (as shown in Figure 10.3).

10fig03.jpg

Figure 10.3 People will see the alt messages while they wait for the graphics to appear.

Even after the graphics replace the alt messages, the alt message appears in a little box whenever the mouse pointer passes over an image. In Figure 10.2, for example, the mouse arrow is over the photo of Han Zol, and the alt message Honest Han is showing. The alt message also helps anyone who is visually impaired (or is using a voice-based telephone interface to read the Web page).

You should generally include a suitable alt attribute in every <img /> tag on your Web pages, keeping in mind the variety of situations where people might see that message. A very brief description of the image is usually best, but Web page authors sometimes put short advertising messages or subtle humor in their alt messages. For small or unimportant images, it's fine to omit the alt message altogether.

Share ThisShare This

Informit Network