Including Alternate Text for Graphics
Placing an alt argument (traditionally called an alt
tag, although it isn’t really a tag) in an <img> tag
creates alternate text for the graphic. This alternate text is a pop-up box that
contains a text explanation of the graphic, much like the title does for a
hyperlink.
Alternate text is not just for decoration; it serves an important purpose for users who cannot view your graphics for some reason. This might include visually impaired users who are accessing your page through the use of a screen-reading program, and people who browse by using PDAs or cell phones.
Alternate text is simple to include; just place an alt="text" argument in the
<img> tag like this:
<img src="leaf.gif" alt="Leaf logo" />
In this exercise, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access