Chris Taylor wrote:
> Hi,
> 
> I've got a bit of a problem. And my CSS isn't working either ;0)
> 
> Basically I want to style links with little icons (an envelope for
> email links, earth icon for web links, download icon for downloadable
> documents etc) but am getting into trouble where the child of the link
> is just an image, not text. The application of the styling is done
> automatically by JavaScript, but I wondered if there was a way in CSS
> to say "style this link, but only if the child of it is not an image".
> 
> Here's an example, the CSS:
> 
>   .externalLink
>   {
> background: url(link.png) no-repeat left center;
> padding: 0 0 0 16px;
>   }
> 
> The HTML:
> 
>   Good: <a href="http://www.webstandards.org"; class="externalLink">Web
> Standards group</a>
> 
>   Bad: <a href="http://www.webstandards.org"; class="externalLink"><img
> src="wsg.png" alt="Web standards group" /></a>
> 
> And what I would like, in psuedo-CSS:
> 
>   /* Style .externalLink where its child is not an img element */
>   .externalLink < img
>   {
> background: transparent;
> padding: 0;
>   }
> 
> Any ideas?

What about:
a.externalLink img {
background: none;
padding: 0;
}

Or am I missing something?

Regards,
Thierry | www.TJKDesign.com


******************************************************
The discussion list for  http://webstandardsgroup.org/

 See http://webstandardsgroup.org/mail/guidelines.cfm
 for some hints on posting to the list & getting help
******************************************************

Reply via email to