Sub topic 6
Writing link text that makes sense out of context
Prerequisites
This chapter assumes you can write an a element with an href attribute and know the difference between block and inline content. It builds on the chapter on creating links.
Why link text matters
Sighted visitors scan a page and see each link next to the text around it. Many screen reader users do something different. They open a list of every link on the page and move through it. Search engines also read link text to learn what the target page is about. In both cases the link text appears alone, without the sentence around it.
Link text that only makes sense in context fails in these cases. A list reading "click here, click here, read more, read more" tells the user nothing.
Common errors
The most frequent mistakes are vague text, bare URLs, and repeated text that points to different places.
<!-- Weak -->
<p>Our pricing changed. <a href="/pricing.html">Click here</a> to see it.</p>
<p>Read the report. <a href="/report-2024.pdf">Read more</a></p>
<p>Visit <a href="https://example.com/a/very/long/path?id=8841">https://example.com/a/very/long/path?id=8841</a></p>
<!-- Better -->
<p>Our pricing changed. See the <a href="/pricing.html">updated pricing plans</a>.</p>
<p><a href="/report-2024.pdf">Read the 2024 annual report (PDF, 2 MB)</a></p>
<p>Visit the <a href="https://example.com/a/very/long/path?id=8841">Example Co. support center</a>.</p>A good link text describes the destination or the action. It is short enough to scan and long enough to be unique on the page.
A quick test
Read only the links on the page, in order. If you can tell where each one goes, the text works. The diagram shows the check.
Add context for the format
If a link leads to a file or does something unexpected, say so in the text. Users then know what will happen before they activate it.
<ul>
<li><a href="/files/guide.pdf">Setup guide (PDF, 1.2 MB)</a></li>
<li><a href="https://example.com/" target="_blank" rel="noopener noreferrer">Example site (opens in a new tab)</a></li>
</ul>When the visible text must stay short
Sometimes a design needs short text such as "Read more" on a row of article cards. Keep the visible words, but add a unique accessible name with aria-label.
<article>
<h3>Spring release notes</h3>
<p>New features for editors and reviewers.</p>
<a href="/news/spring.html" aria-label="Read more: Spring release notes">Read more</a>
</article>Keep the visible words at the start of the aria-label. People who use voice control say the words they see, and a label that doesn't contain them can stop the command from working. Use this as a fallback. Plain descriptive text is better because it helps everyone.
Summary of rules
| Do | Avoid |
|---|---|
| Name the destination or action | "Click here", "here", "link" |
| Make each link unique on the page | Same text pointing to different URLs |
| Mention format or new-tab behavior | Surprising downloads |
| Use words people see on the page | Raw URLs as link text |
Exercise
A page has three cards, each with a link that says "Learn more". The cards are about Pricing, Security, and Support. Rewrite one link so it still works in a list of links and keeps the visible text "Learn more".
Show answer
Add an accessible name that starts with the visible words, for example <a href="/security.html" aria-label="Learn more: Security features">Learn more</a>. A better fix is to change the visible text itself, such as <a href="/security.html">Learn about our security features</a>.