HTML and CSS Reference
technology (including Web sites) associated with the federal government. The alt
attribute configures an alternative text description of the image. This alt text is used by
the browser in two ways. The browser will show the alt text in the image area before
the graphic is downloaded and displayed. Some browsers will also show the alt text as
a tool tip whenever the Web page visitor places a mouse over the image area. Applications
such as screen readers will read the text in the alt attribute out loud.
Standard browsers such as Internet Explorer and Safari are not the only type of applica-
tion or user agent that can access your Web site. Major search engines run programs
called spiders or robots; these programs index and categorize Web sites. They cannot
process images, but some process the value of the alt attributes in image tags.
Focus on Accessibility
The longdesc attribute is used to provide accessibility when the alt text description is
too short to convey the meaning of the image. The value of the longdesc attribute is
the URL of a Web page that contains a detailed text description and explanation of the
image. Most current browsers do not support this attribute but you can expect
expanded support in the future.
Legacy Alert. The align , vspace , and hspace attributes help position the image on
the page relative to text. Examples of formatting images and text using vertical align-
ment properties are shown in Figure 4.14.
Figure 4.15 provides examples of horizontal alignments, the hspace attribute , and the
vspace attribute . The hspace and vspace attributes are used to add space around an
Since you'll find many pages on the Web coded using the deprecated attributes of the
image element ( align , hspace , vspace , border ), it's a good idea to become familiar
with them. CSS techniques that replicate the functionality of these attributes will be
discussed in Chapter 6.
Examples of vertical alignment
Examples of horizontal alignment