CSS: Automatically Marked and Accessible External Links
The guideline 13th from the Web Content Accessibility Guidelines 1.0 clearly states that a website should provide clear navigation mechanisms.
13.1 Clearly identify the target of each link. [Priority 2]
Link text 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. For example, in HTML, write “Information about version 4.3″ instead of “click here”. In addition to clear link text, content developers may further clarify the target of a link with an informative link title (e.g., in HTML, the “title” attribute).
This guideline indicates that every external link should be clearly marked. I believe that is important to make websites that are accessible but on the other hand marking all external using classes or title attributes it is time consuming and prone to error. It would be very easy to overlook the odd link, well at least for a forgetful soul like me.
The method used in this tutorial addresses this issue effectively using only CSS.
The following CSS attribute selector selects any link with the href attribute that begins with “http://“, but does not contain the defined domain name (yourdomain.com for this example). It uses two separate attribute selectors so that it will match the URI whether or not uses the www.
a[href^="http://"]:not([href*="yourdomain.com"])::after {
content: "\2197";
}
The CSS code above matches:
<a href="http://www.yourdomain.com">Link with www</a>
and
<a href="http://yourdomain.com">Link without www</a>
Smashing Magazine has explored this technique before, the CSS code above simply places an north east arrow ( ↗) after any outgoing link. To make things a little prettier I have just tweaked it further:
1. To make the icon appearing different for each link state, I have created three variations of the same image in one file:
![]()
2. Added a CSS rule to add a background image to the normal state of the external link.
a[href^="http://"]:not([href*="yourdomain.com"]) {
background: url(images/external_link.png) no-repeat 100% 3px;
padding: 0 12px 0 0;
}
3. Added a CSS rule to add a background image to the hover state of the external link.
a:hover[href^="http://"]:not([href*="yourdomain.com"]) {
background: url(images/external_link.png) no-repeat 100% -97px;
padding: 0 12px 0 0;
}
4. Added a CSS rule to add a background image to the visted state of the external link.
a:visited[href^="http://"]:not([href*="yourdomain.com"]) {
background: url(images/external_link.png) no-repeat 100% -197px;
padding: 0 12px 0 0;
}
Note
Internet Explorer doesn’t seem to like this method very much. It is not a big deal though because it simply ignores the rule, not displaying the background image. But to be honest… Who cares! There are so many standard compliant rules that don’t work with IE anyway.
Let me know what you think if you encounter any problems with this method or if you feel that there are better ways to achieve this.
Tino
Popularity: 100%
What I´m listening to: Craig Armstrong - William Shakespeare's Romeo + Juliet: Music From The Motion Picture, Volume 2 (1996 Version)
This Post Was Brought To You By:
Related Posts
blog comments powered by Disqus



Add New Comment
Viewing 51 Comments
Thanks. Your comment is awaiting approval by a moderator.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
There is an obvious link between these two realities. Our brain is a tool to take full advantage of these laws of nature through an efficient technique of meditation. This is currently explored within science. Any experience related to God, in any form, must be an expression of the laws of nature. It is not a peculiar unification. It is not at all a diminution of God. It is a better appreciation of the laws of nature. It's the same.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Web Application Development Services
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Read about Replica Watches here
Genuine watches of these replicas are very expensive and the choice of the rich, famous and collectors around the world. These fake watches were designed with the greatest detail and craftsmanship.replica watches are inexpensive and sometimes give the impression that you are wearing the Genuine Rolex replica watches while you are catering the posh cocktail party.
Our Replica Watches Category:
Oris Watches
replica Oris Watches
Breitling Watches
replica Breitling Watches
Cartier Watches
replica Cartier Watches
TAG Heuer Watches
replica TAG Heuer Watches
Panerai Watches
replica Panerai Watches
Chopard Watches
replica Chopard Watches
Patek Philippe Watches
replica Patek Philippe Watches
Omega Watches
replica Omega Watches
IWC Watches
replica IWC Watches
Movado Watches
replica Movado Watches
Rado Watches
replica Rado Watches
replica watches
replica watch
fake watches
fake watch
NOTICE OF OUR SITE
At www.sales-luxury.org we specialize in top quality Replica Handbags, Replica handbags and so on. Swiss engineering with Replica watches, precision crafted timepieces & fake watch; replica handbags are perfect for the birthday gifts and valentine's gifts. Replica watches, replica handbags are not cheap imitations; they are genuine replica of the original products. Wearing these expensive Replica watches & replica bags is prestigious; they make a statement at work and at play. The pictures on our site are of a random sampling of our stock. You will receive the fake watches; fake handbags will be identical to the item in the picture. We give priority to high quality. We do not manufacture the replica watch, Replica handbags until we have checked the original for all the correct markings and materials. We manufacture our own exclusive replica so we oversee the production.
Nike 1World Air Force 1 “Daisuke Matsuzaka”
This is a Nike 1World sneaker that shows the campaign created by Nike. Nike will go around the world to work with different people to create new shoes. This model is the product of the project with Daisuke Matsukaza, a Japanese baseball player. Nike Sneaker The basic model that is used is the Air Force One.
The result is a white orange colorway for a new Air Force 1. One special feature is the use of white pony hair. The orange leathers are from exotic leathers. To reflect the Japanese culture, a dargon motive was chosen to be placed on the heel and the inner sole. Daisuke Matsukaza plays with the Boston Red Sox under his number 18. Thus the design uses the number 18. This sneaker will be released at a later date. website: http://www.brandtrading.net
The toe box is white colored. The mudguard, midsection and the Nike swoosh are also white colored. The shoe lace is orange, threaded through a panel of orange colored shoe lace holes. The heel is a large segment of orange exotic leather. Nike Sneaker The back tab is white. There is a collar of orange leather lining the ankle of the shoe. The orange midsole and outsole make this a bright looking shoe.
KeyWords: Nike Sneaker | Gucci Shoes | Adidas Shoes | Nike Shoes
Do you already have an account? Log in and claim this comment.