See also the ALT text mini FAQ.
The alt
text of an IMG
element is
alternative text, that is, text that should completely
replace the image, if the image cannot be shown. In other words,
if the image could not be drawn, then it should not be
replaced by a box containing the alt
text,
instead, the alt
text should be drawn inline.
Several non-textual elements (IMG, AREA, APPLET, and INPUT) let authors specify alternate text to serve as content when the element cannot be rendered normally.
Lynx does this correctly.
There now follows a section representing a company's home page. It
consists of an H1
element containing a single image, the
logo of a company, followed by a paragraph.
Welcome to the XYZ Company website.
But! Oh, No! The image cannot be displayed! (This may be because
image loading is disabled or because the link is broken, for example.)
The 'usual', wrong, way of drawing the result is to draw the
alt
text in a box. Something like this:
Welcome to the XYZ Company website.
This is wrong. It is an incorrect
rendering. None of the tests in section 2 should look anything
even remotely like the above. The alt
text should
appear inline, as if the IMG
wasn't there. Like this:
Welcome to the XYZ Company website.
Now that you know what should happen, here is how this browser does it:
Welcome to the XYZ Company website.
The above should be indistinguishable from the last example in section 1.
Note that this only applies to once the image cannot be
displayed. While the image is still being fetched, then if the
IMG
has explicit height
and
width
attributes, it should be drawn in as a placeholder.
This is because it is then an aid to incremental rendering, and users
do not have to see their page jump whenever a page is downloaded.
The placeholder should go away if the image is later found to be
undrawable.
Here is how this browser copes with explicit height
and width
attributes, when the image can be
fetched (this should look the same as the first demo of section 1):
Welcome to the XYZ Company website.
And here is how this browser copes with explicit
height
and width
attributes, once the image
is known to be unfetchable (or if images are disabled):
Welcome to the XYZ Company website.
This last test should look the same as the last demo of section 1.
Bugzilla: Bug 1994
Last updated in January 1999.