What is the standard way to add an icon to a link with CSS?

Posted by ewernli on Stack Overflow See other posts from Stack Overflow or by ewernli
Published on 2010-06-10T12:54:00Z Indexed on 2010/06/10 13:12 UTC
Read the original article Hit count: 221

Filed under:
|

I'm used to use padding + background-image to place an icon next to a link.

There are many example of this approach. Here is one from here:

 <a class="external" href="http://www.othersite.com/">link</a>

  a.external {  
     padding-right: 15px;  
     background: transparent url(images/external-link-icon.gif) no-repeat top right;  
 }    

But most browser don't print background image, which is annoying.

What is the standard to place icon next to links which is semantically correct and works in all cases?

(I couldn't find an exact similar question. If there is one, just close this one as duplicate)

© Stack Overflow or respective owner

Related posts about css

Related posts about web-design