1 reply [Last post]
ppp
Offline
Regular
Last seen: 15 years 47 weeks ago
Joined: 2004-09-20
Posts: 22
Points: 0

i postet this befpre on a german board where they couldn't help me ( [url]http://www.softgames.de/node/ )

my problem: i found this handy css code which attaches an icon to a link if its going 'outside' of your website (linking to http://):

a[href^='http:'] {
   padding-right: 12px;
   background-image: url("../icons/stock_internet.png");
   background-position: right top;
   background-repeat: no-repeat;
   } 

works perfect, at least in mozilla (firefox), ie off course doesnt understand :roll:

now my problem: how can i prevent attaching the icon if in the href-tag an picture is includet (eg. an banner linking to another page), because i think that behaviour looks really whacky.

guy at the page i mentioned above gave me the tip to create an own class to asign for extern links, but thats not really what i want (because it will cause of rewriting my whole page).

co2
co2's picture
Offline
Leader
UK
Last seen: 12 years 18 weeks ago
UK
Joined: 2003-09-17
Posts: 721
Points: 0

atomatic icon attach

Off the top of my head, I think using a class is the only way. The attribute selectors are precisely that, to indicate a tag with a specific attribute (in your case, the href address). However, there is no attribute which occurs within the anchor tag, to indicate that its content is an image.

There may be a solution, and I'll try and give it a bit more thought. But at present, its signifying with a class seems the reasonable way.

The next sentence is true. The previous sentence is false. Discuss...