Previous Message
Next Message

[css-d] Need help with contextual selectors

Sent by Martin Sammtleben on 24 April 2002 20:08


Hi everyone,

I have been lurking now for quite some time soaking in what I could 
digest but now I'm having a real problem which I hope you can offer 
me some help with:


I want all my text links by default to have a border of 2px and 
switch the backgrond color on hover. This works using the following 
CSS:

a  { color: #c00; background-color: transparent; border-style: solid; 
border-width: 2px; border-color: white }
a:visited  { color: #336; background-color: transparent; 
border-style: solid; border-width: 2px; border-color: white }
a:hover  { color: white; background-color: #c00; border-style: solid; 
border-width: 2px; border-color: #c00 }
a:active  { color: #c00; background-color: transparent; border-style: 
solid; border-width: 2px; border-color: white }

So far so good. Of course I need to turn off the border for every 
image nested inside <a> tags. I should be able to do so by using 
contextual selectors or so I thought but whatever I try the darned 
borders around my image buttons won't go away.
I tried adding

img a { border: solid 0px }	or

a img { border: solid 0px }


and a few other variations but to no avail  :-(

What am I doing wrong  - I'm totally clueless !

Any hint is most appreciated  :-)


Cheers   Martin
Previous Message
Next Message