Element

img

Error Type

Likely

Guidelines

Requirement

Non-Decorative images must have Alt text.

Error

Image has suspicious Alt text (empty string "").

Short Description

img element cannot have alt attribute value of null ("") if WIDTH and HEIGHT attribute values are both greater than 25.

Rationale

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

How To Determine

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

Steps To Check

Procedure

1. Check each img element and view its alt attribute value.
2. If the alt attribute value is an empty string ("") then proceed to the next step.
3. Determine if the image has non-decorative content.

Expected Result

1. The alt attribute value contains text if the image is non-decorative.

Failed Result

1. If the image is non-decorative and the alt attribute value is an empty string ("") then add an appropriate alt attribute value.

Examples

Pass Examples

IMG is non-decorative and has valid Alt text.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html lang="en">
<head>
<title>OAC Testfile - Check #4 - Negative</title>
</head>
<body>
<p>We would like to adopt another pet and are looking for one that is similar to what's shown in the picture.</p>
<img src="rex.jpg" alt="large brown and black cat named Rex" width="150" height="105"/>
</body>
</html>

Fail Examples

IMG is non-decorative but has empty Alt text.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html lang="en">
<head>
<title>OAC Testfile - Check #4 - Positive</title>
</head>
<body>
<p>We would like to adopt another pet and are looking for one that is similar to what's shown in the picture.</p>
<img src="rex.jpg" alt="" width="150" height="105"/>
</body>
</html>
Web site engine's code is copyright © 2023
Inclusive Design Institute