...

View Full Version : Preventing image links to have a background color?



Allen121
01-30-2005, 10:59 PM
I'm a little new to CSS so I apologise if this is an easy answer. I want all hyperlinks to change the background color when the cursor hovers over it. But I don't want image links to change though. What code prevents this? Thanks!


a:hover {
color:2E415A;
font-size:10pt;
font-family:arial;
font-style:normal;
text-decoration:none;
background-color:DDEEFF;
}

hemebond
01-30-2005, 11:41 PM
Hmm. I'm not sure you can. Right now there's no way to style an element based on its children.

cfc
01-30-2005, 11:45 PM
I think you'll have to give your image links a class of their own...

a.imglink:hover {
background-color: transparent | any colour;
}

if you're talking about borders, use:

a img {
border: none;
}

<a class="imglink" href="somewhere"><img src="myimage.png"/></a>

Allen121
02-03-2005, 08:32 PM
Thanks cfc, that worked. You're the man!!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum