Home / Best Practices / Links

Links

Basics

  1. Write meaningful link text.
  2. When linking to documents, indicate the document title and type of file.
  3. Links that open popups and new windows should explain the action to expect.
  4. The ALT attribute on linked images should describe both the content of the image and the function of the link.
  5. Ensure a 3:1 contrast between the text link and surrounding non-link text color.
  6. Don't rely solely on color to convey links.
  7. Never use CSS to remove the outline from links.  Ensure the focus state is highly visible.

In depth

Links that clearly communicate their destination help users decide what action to take. For people using screen readers or other assistive devices, meaningful links can save much time and frustration. Low-vision users and those who are color blind or have other vision issues rely on links that are clearly marked and that respond with a noticeable focus state.

Meaningful link text

Screen readers can generate and read aloud a list of the links found on a page. This is a useful way to navigate, provided the links are descriptive.  For instance, a list of "Read more" links doesn't adequately describe the links' various destinations. Using the destination page's title or subject matter as the link text is much more informative.

Other tips for writing accessible link text include:

  • Use unique text for links with different destinations (two or more "Click here" links going to different pages is confusing).
  • Use the same text for links that go to the same destination page.
  • Don't use the link URL (https://webapp4.asu.edu/programs/t5/majorinfo/ASU00/LAMATBS/undergrad/false) as the link text. (Screen reader users find it tedious to have to listen to long URLs read aloud.)
  • When linking to files, it's helpful for users to know the file type they're opening or downloading.
Unhelpful link textMeaningful link text
Click here to learn the difference between animal, vegetable and mineral.Learn the difference between animal, vegetable and mineral.
Take courses online this summer (read more)Take courses online this summer
You should read this article about the Savannah cat.You should read this article about the Savannah cat.
http://school.asu.edu/courses/sum-abroad/sum-app.pdfSummer Application (PDF)
http://webaim.org/techniques/hypertext/Links and Hypertext

Links that open pop ups and new windows

Pop ups and new windows introduce many usability problems and should be employed sparingly. If needed, links that open pop ups and new windows should contain text explaining the action that will occur to minimize users' confusion.

Examples:

<a href="https://www.amazon.com/gp/product/1430241942/" target="_blank">Buy
this book (opens a new window)</a><a href="description.html" rel="popup">Course description (opens in a pop up)</a>

Linked images

When using linked images, the image ALT attribute should describe both the content of the image and the function of the link. Often those are the same thing, as in the case of button images. (See more about linked images.)

Empty links

Don't use empty links, like <a href="#">. An <a> element with an empty HREF is not keyboard accessible (see more in Javascript).

Visually distinguishable links

Text links should have 3:1 contrast between the link text color and the surrounding non-link text color. However, don't rely solely on color to convey links. Instead, always employ a secondary visual cue, such as an underline or border  (see more in Color and Contrast).  In addition, secondary non-color visual cues should display on both mouse hover and keyboard focus (see more in Keyboard Access).

Finally, never use CSS to remove the outline from links, unless you intend to replace it with a more visible focus state cue.

How to test

Using your keyboard, tab through the page:

  1. Are you able to tab to every link?
  2. Is the destination of every link clear from its link text, even when it's removed from the content?
  3. Do any links use the same link text but have different targets?
  4. Are links to documents, files, pop ups and new windows indicated as such?
  5. Do linked images contain an ALT tag that explains both the content of the image and the destination (if different)?
  6. Are links visually obvious?  Do they have:
  • a 3:1 contrast with backgrounds?  
  • a secondary visual cue?
  • distinctive hover and focus states?

Chrome WAVE extension
WAVE marks links with a hand icon, indicating redundant links, ambiguous link text, empty links (hrefs) and more.  It will also check that linked images have ALT tags.

Relevant W3C WAI documents

  • WCAG 2.1 Guideline 2.4.4 Link Purpose (In Context): The purpose of each link can be determined from the link text alone or from the link text together with its programmatically determined link context, except where the purpose of the link would be ambiguous to users in general.
  • How to Meet WCAG 2.1 Guideline 2.4.4