a {
color:#000070;;
font-size:11px;
text-decoration:underline;
font-weight:550;
font-family:verdana, arial, helvetica, sans-serif;
}
a img { /* Gets rid of border around images. */
border:none;
}
a:link {color:#000070;}
a:visited {color:#000045;}
a:hover {background-color:#fff;}
/* Here is the line I thought would work: */
a img:hover {background-color:transparent;}
[web] More trouble with CSS and new site
Hello,
On the site I am working on, someone already helped me fix a problem where I had a border around an image. (The answer seemed so simple, and I felt stupid.) The problem now is that I have the background color of a link set to white when the mouse hovers over it. I don't want this affect with images though. How can I get rid of it?
The CSS in question:
Thanks, Slaru
Don't set the a:hover globally. Do something like this, instead:
That way it will only affect A tags inside the #menu element.
#menu a:hover {background:#fff;}
That way it will only affect A tags inside the #menu element.
I tried
#menu a:hover {background:#fff;}
and it worked. However, I would like to make it so that all images have a transparent background when hovered over with one statement, instead of a #menu a:hover... for every element. Is this possible?
#menu a:hover {background:#fff;}
and it worked. However, I would like to make it so that all images have a transparent background when hovered over with one statement, instead of a #menu a:hover... for every element. Is this possible?
Does anyone know how to set the background color for all images that are links to transparent, and the background of all other links to another color?
a:hover {background-color: red;}a.classname {background-color: transparent;}...<a href="thing.html">link one</a><a href="thing.html">link two</a><a class="classname" href="thing.html"><img src="happy.gif"></a><a class="classname" href="thing.html"><img src="sad.gif"></a>
There are no ancestor or parent selectors in CSS so you will have to distinguish the links containing images manually.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement