Skip to main content

Jim Byrne Accessible Website Design Glasgow for The Third Sector, Voluntary, Charities and Not for Profits

Accessible, Responsive Website Design
Jim Byrne Web Designer

All Accessibility Blog Posts

Published: April 8, 2022

Add alt attributes to decorative images

Published: August 19, 2014

Always add an empty alt attribute to every spacer or decorative image you use in your website, i.e. <img src=”spacer.gif” alt=””>.

If spacer or decorative images have no alt attributes, those browsing with images off, or with text browsers, will either see or hear the file name, or the text ‘[image]’, for each image lacking an alt attribute.

Decide whether your non-text elements are functional, decorative or providing content?

Published:

Labels should be added to all non-text content; the alt attribute is a requirement for both HTML 4 and XHTML W3C standards based documents.

When trying to decide on the text label required for a particular non-text element, I find it helps to think of them as (roughly) falling into one of three categories: functional, decorative (including layout), or providing content.

Functional

For functional images, including navigation bars (and horizontal rules) the text should describe the function or destination. For example, if an image is used as a search button, the alt attribute could be ‘Search’, if an image is used for navigation the alt attribute should describe the destination. Usually the alt attribute for functional images contains the same text as appears on the graphic button or navigation bar.

Providing content

For images that contain important content, the alt attribute should provide a short description of the content (a few words that sums up the content). Use the title or longdesc attributes for longer descriptions.

Decorative including layout images (e.g. single pixel gifs)

For purely decorative images, or images used to help with the layout of a page, the alt attribute should be empty (alt=”‘).

Let's Chat

07810 098 119

Alternative access to client feedback

“The audit was extremely comprehensive, clear and demonstrated Jim’s expertise in the area of accessible web design.” Peter Madden, Project Manager, Sealed Envelope Ltd