Element

img

Error Type

Likely

Guidelines

Requirement

Important images should not have spacer Alt text.

Error

Image has suspicious Alt text (all spaces).

Short Description

img element cannot have alt attribute value of whitespace if WIDTH and HEIGHT attribute values are both greater than 25.

Rationale

All images require a text equivalent (Alt text) but you may set the Alt text to all spaces (" ") for decorative images. This image has spacer Alt text but does not appear to be a decorative image.

How To Determine

Question Is this a decorative image that requires spacer Alt text?
PASS Image is decorative (spacer Alt text is OK).
FAIL Image is not decorative (spacer Alt text is not OK).

Steps To Check

Procedure

1. Check each img element that has width and height attribute values that are both greater than 25.
2. View the alt attribute value for the img element.

Expected Result

1. The alt attribute value is expected to contain one or more characters that are not whitespace characters.

Failed Result

1. If the alt attribute value is whitespace then either add an appropriate alt attribute value or confirm that current empty value is appropriate for the associated image.

Examples

Pass Examples

img element has whitespace Alt text but width and height are less than 25.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN""http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<title>OAC Testfile - Check #5 - Negative</title>
</head>
<body>
<img src="spacer.gif" alt="  " width="5" height="5"/>
</body>
</html>

Fail Examples

img element has whitespace Alt text and width and height are both greater than 25.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN""http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<title>OAC Testfile - Check #5 - Positive</title>
</head>
<body>
<img src="rex.jpg" alt="  " width="150" height="105"/>
</body>
</html>
Web site engine's code is copyright © 2023
Inclusive Design Institute