Previous Message
Next Message

Hover [reformulated]

Sent by Zoe M. Gillenwater on 16 August 2007 13:01


faramineux wrote:
> Here is the basic code I use for links:
>
> a:link {
> color: #5a0113;
> font-size: 13px;
> font-weight: normal;
> text-decoration: none;
> }
>
> a:hover {
> color: #2B4058;
> font-size: 13px;
> font-weight: normal;
> background-color: #fffbdf;
> border-bottom-style: dashed;
> border-bottom-width: 1px;
> }
>
> The 3 linked images - including the logo -  on the page show the  
> styling too on hover! For example when I hover over the logo, the  
> dash line/color appear under the logo. Something is wrong.
>
>   

Nope, I'm afraid this is correct behavior. If you have this markup:
<a><img></a>

The border and background will show up on that <a> element that is 
wrapped around the <img> element, because it's just another <a> element. 
The styling is not showing up on the <img> element, but on the <a> 
element around it.

There is no selector in CSS 2.1 to select an element based on its child, 
so there's way to say "select all <a> elements that have <img> elements 
as their children." Thus, the only way you can get rid of the styling on 
these particular a elements is to give them a class.

a.imglink:hover {
background: none;
border: none;
}

Zoe
______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
IE7 information -- http://css-discuss.incutio.com/?page=IE7
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Previous Message
Next Message

Message thread:

Possibly related: