Alternative text

Alternate text allows you to get text information about the image when the download of images is disabled in the browser. Since images are downloaded after the browser receives information about it, the text replacing the picture appears earlier. And as the download progresses, the text will be replaced by the image (Figure 1).

Fig. 1. Alternative text before image loading

Some browsers, in particular Internet Explorer, also display alternative text in the form of a hint that appears when you hover the mouse over an image (Figure 2).

Fig. 2. Type of tooltip

Comment

The appearance of the tooltip, namely its color, background, font and other parameters is set by the operating system settings and can not be changed via an HTML file.

To create alternative text, use the alt parameter of the <IMG> tag, as shown in Example 1.

Example 1. Adding alternative text

Valid code
<! DOCTYPE HTML PUBLIC "- // W3C // DTD HTML 4.01 // EN" "http://www.w3.org/TR/html4/strict.dtd">
<Html>
<Head>
<Meta http-equiv = "Content-Type" content = "text / html; charset = windows-1251">
<Title> Alternate Text </ title>
</ Head>
<Body>
<P> <a href="index.html"> <img src = "home.gif" alt = "Return to home page" > </a> </ p>
</ Body>
</ Html>

The text in the alt parameter must be quoted.

Copyright © www.htmlbook.ru