2010-10-10 74 views
15

我需要更改悬停时按钮的颜色。如何在悬停时更改按钮的颜色?

这是我的解决方案,但它不起作用。

a.button { 
    display: -moz-inline-stack; 
    display: inline-block; 
    width: 391px; 
    height: 62px; 
    background: url("img/btncolor.png") no-repeat; 
    line-height: 62px; 
    vertical-align: text-middle; 
    text-align: center; 
    color: #ebe6eb; 
    font-family: Zenhei; 
    font-size: 39px; 
    font-weight: normal; 
    font-style: normal; 
    text-shadow: #222222 1px 1px 0; 
} 
a.button a:hover{ 
    background: #383; 
} 

回答

32

a.button a:hover表示“这是正在上空盘旋,一个环节是与类button链接的孩子”。

改为a.button:hover

10

看来你的选择是错误的,请尝试使用:

a.button:hover{ 
    background: #383; 
} 

您的代码

a.button a:hover 

意味着它会搜索里面a带班按钮的a元素。

0
a.button:hover{ 
    background: #383; } 

对我的作品,但我的情况

#buttonClick:hover { 
background-color:green; }