<?xml version="1.0" encoding="utf-8"?>

Use the null attribute for decorative images

Use the null attribute for decorative images Bad Practice
Use the null attribute for decorative images Best Practice

Not all images have meaningful content. Decorative elements like abstract patterns, background textures, or spacer graphics enhance visual appeal without conveying essential information. For such purely aesthetic images, use empty (null) alt attributes instead of descriptive text.

Adding a null alt attribute (alt="") explicitly tells screen readers and other assistive technologies to skip the image. This prevents unnecessary interruptions in the user experience for people relying on text-to-speech tools. Without null attributes, assistive technology might attempt to interpret or announce decorative images, creating confusion and diminishing usability.

Determining whether an image is decorative requires careful consideration. Ask yourself: "If this image were removed, would the user miss any important information?" If the answer is no, a null alt attribute is appropriate. This thoughtful approach helps create cleaner, more efficient experiences for all users, particularly those with cognitive or visual disabilities.

Improve your UX & Product skills with interactive courses that actually work