Smart CSS trick to add icon to all outgoing links

Use this piece of CSS to add an icon to all links that is not to mydomain

a:not([href*="mydomain"]) {

 padding-right: 10px;

 background: transparent url("images/aoutside.gif") center right no-repeat;



}

Alternatively, you can use this one to mark all links that start with ‘http://

a[href^="http"] {

padding-right: 10px;

background-image: url(external.gif);

background-position: right !important;

background-repeat: no-repeat;

}

Popularity: 6% [?]

No Comments Posted in CSS

Leave a Reply

Using Gravatars in the comments - get your own and be recognized!

XHTML: These are some of the tags you can use: <a href=""> <b> <blockquote> <code> <em> <i> <strike> <strong>