Web Design Articles

Simple, accessible external links


Russ Weakley
11-Dec-05

The scenario
The Web Content Accessibility Guidelines 1.0 state:

"Clearly identify the target of each link. [Priority 2] Link text (The rendered text content of a link) should be meaningful enough to make sense when read out of context -- either on its own or as part of a sequence of links. Link text should also be terse."

Web Content Accessibility Guidelines 1.0

Depending on how this checkpoint is read, this could mean that every external link should be identified within the link text itself. For example, you could use " (off-site link)" or "(external link)" within any link text that points to any external resource.

The problem

Is there a way to add descriptive text to all external links and then replace this text with a small icon for CSS supporting browsers?

The solution

1. Give the external link a class.

<a class="external" href="#">sed diam nonummy</a>

2. Although a title attribute could be used here, a recent study on titles by Steve Faulkner has shown that the title attribute is not displayed in a device independent way in any browser. Instead, add descriptive text within the external link to help identify the target.

<a class="external" href="#">sed diam nonummy (external link)</a>

3. Wrap the descriptive text inside a <span> element.

<a class="external" href="#">sed diam nonummy<span> (external link)</span></a>

4. Create a CSS rule to "hide" the descriptive text. While using "display: none" seems the best solution, this method is not currently supported by many screen readers. For this reason, using absolute positioning to push the text off the screen is one preferred option.

a.external span
{
position: absolute;
left: -5000px;
width: 4000px;
}

5. If you'd like the icon to appear different for each link state, create three variations of the same icon in the one file - leaving a lot of space between each version. For example:

6. Create a CSS rule to add a background image icon to the external link

a.external:link
{
background:

url(icon.gif) no-repeat 100% 0;
padding: 0 20px 0 0;
}

7. Create a CSS rule to add a background image icon to the visited state of the external link

a.external:visited
{
color: purple;

background:

url(icon.gif) no-repeat 100% -100px;
padding: 0 20px 0 0;
}

8. Create a CSS rule to add a background image icon to the hover state of the external link

a.external:
hover
{
color: red;

background: url(icon.gif) no-repeat 100% -200px;
padding: 0 20px 0 0;
}

9. Theoretically, the "external link" icon should be explained somewhere on the site.

Examples
Without CSS applied


Lorem ipsum dolor sit sed diam nonummy (external link) nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.

With CSS applied

Lorem ipsum dolor sit sed diam nonummy (external link) nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.

Note:

In some versions of Windows Internet Exporer, where links wrap over two lines, the background image will be displayed at the end of the first line rather than at the end of the link element.
















why-css-is-good-for-google
using-relatve-font-sizes
random-content-rotation
web-design-xhtml-1-1
web-design-resources
accessibility-intro
web-design-xhtml-2-1
why-internet-marketing
xhtml-latin-1-character-references
google-updates
google-dance
css-positioning-properties
fancy-paragraphs
bob-regan-macromedia-accessibility
web-design-technologies
wrox-beginning-php-4-chapter-3-1
julie-howell-rnib-accessibility
handy-hints-web-design
mod_accessibility
pagerank-1
search-engine-crawling
Definition lists - misused or misunderstood.html
Accessible Data Tables
Developing sites for users with Cognitive disabilities and learning difficulties
An Accessibility Frontier Cognitive disabilities and learning difficulties
Inline elements and padding
Basic webstandards Workshop
Internet Explorer and column collapse
Building a page template in CSS - a step by step tutorial
Remote control CSS
Colored boxes - one method of building full CSS layouts
Replicating a Tree table
Creating a graph using percentage background images
Simple, accessible external links
Simple, accessible more links
Styling abbreviations and acronyms
 Web standards checklist
Floated items inside containers
Liquid layouts the easy way
Two columns with color
CSS Centering - fun for all!
Body padding and margin
List inheritance and Descendant Selectors
Taming the Taming lists model
Headings as images - The Lindsay method
Ideal line length for content
Validating Australian Museum Online
Styling the hr element
Styling and font family names that contain whitespace
Sample CSS Page Layouts
how_to_find_good_freelancer
using_colors_on_website
annoying-website-design
 
cross_browser_compatibility
banner-design-success-techniques
 
craig-tanner-freelance
ecommerce-website-design
 
ppc
separating-content-from-presentation
 
alternative
web_page_optimization
 
personalization
communicating_needs_web_designer
 
buzz
design_it_yourself_or_hire_pro
 
social_bookmarking2
w3c_validation.php
social_bookmarking
web_design_guidelines
 
digg
photo_optimization
 
buzz2
website_templates
 
viral_video
web_design_versus_web_development
 
controversy
graphic_formats
 
 
good_website_navigation_is_important