Techniques for WCAG 2.0

Skip to Content (Press Enter)

This document is a draft, and is designed to show changes from a previous version. It is presently showing added text, changed text, deleted text, [start]/[end] markers, and Issue Numbers.

Hide All Edits   |   Toggle Deletions  |   Toggle Issue Numbers   |   Toggle [start]/[end] Markers   |   Show All Edits

Changes are displayed as follows:

-

H30: Providing link text that describes the purpose of a link for anchor elements

Applicability

HTML and XHTML documents that contain links, (<a href> elements)

This technique relates to:

Description

The objective of this technique is to describe the purpose of a link by providing descriptive text as the content of the a element. The description lets a user distinguish this link from other links in the Web page and helps the user determine whether to follow the link. The URI of the destination is generally not sufficiently descriptive.

When an image is the only content of a link, the text alternative for the image describes the unique function of the link.

When the content of a link contains both text and one or more images, if the text is sufficient to describe the purpose of the link, the images may have an empty text alternative. (See H67: Using null alt text and no title attribute on img elements for images that AT should ignore (HTML) .) When the images convey information beyond the purpose of the link, they must also have appropriate alt text.

Examples

Example 1

Describing the purpose of a link in HMTL in the text content of the a element.

<a href="routes.html">
  Current routes at Boulders Climbing Gym
</a>

Example 2

Using the alt attribute for the img element to describe the purpose of a graphical link.

<a href="routes.html">
   <img src="topo.gif" alt="Current routes at Boulders Climbing Gym" /> 
</a> 

Example 3

Using an empty alt attribute when the anchor (a) element contains text that describes the purpose of the link in addition to the img element. Note that the link text will appear on the page next to the image.

<a href="routes.html">
  <img src="topo.gif" alt="" />
  Current routes at Boulders Climbing Gym
</a>

Example 4

A link contains an icon and text, and the site help refers to the icon. The img has a text alternative which is the name used for the icon in the site help, which describes clicking the home page icon.

<a href="foo.htm">
  <img src="house.gif" alt="home page icon"/>
  Go to the home page
</a>

Resources

Resources are for information purposes only, no endorsement implied.

Tests

Procedure

For each link in the content that uses this technique:

  1. Check that text or a text alternative for non-text content is included in the a element

  2. If an img element is the only content of the a element, check that its text alternative describes the purpose of the link

  3. If the a element contains one or more img element(s) and the text alternative of the img element(s) is empty, check that the text of the link describes the purpose of the link

  4. If the a element only contains text, check that the text describes the purpose of the link

Expected Results