按钮背景不会改变悬停

时间:2014-03-11 14:11:30

标签: html css button background hover

我已经使用常规方法创建了一个按钮作为链接,但是,我遇到了一个奇怪的问题,即悬停时背景颜色不会改变,应该是什么时候。

我可能错过了一些非常明显的事情,但我无法为我的生活找到它。

有问题的代码是:

.downloadbtn {
    color: white;
    display: block;
    margin: auto;
    width: 250px;
    height: 60px;
    margin-top: 30px;
    padding: 20px;
    background: #06bce4;
    background: -moz-linear-gradient(top,  #06bce4 0%, #0589d4 100%);
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#06bce4), color-stop(100%,#0589d4));
    background: -webkit-linear-gradient(top,  #06bce4 0%,#0589d4 100%);
    background: -o-linear-gradient(top,  #06bce4 0%,#0589d4 100%);
    background: -ms-linear-gradient(top,  #06bce4 0%,#0589d4 100%);
    background: linear-gradient(to bottom,  #06bce4 0%,#0589d4 100%);
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#06bce4', endColorstr='#0589d4',GradientType=0 );
    border: 1px solid #076ca0;
    border-radius: 4px;
    -webkit-box-shadow: inset 0px 1px 0px 0px rgba(64, 209, 236, 1);
    -moz-box-shadow: inset 0px 1px 0px 0px rgba(64, 209, 236, 1);
    box-shadow: inset 0px 1px 0px 0px rgba(64, 209, 236, 1);
    -webkit-animation-delay: 2s;
    -webkit-animation-iteration-count: infinite;
    -webkit-animation-duration: 6s;
    -moz-animation-delay: 2s;
    -moz-animation-iteration-count: infinite;
    -webkit-animation-duration: 6s;
}

.downloadbtn :hover {
    background: green;
}

JSFiddle在这里:http://jsfiddle.net/4Xxaf/

2 个答案:

答案 0 :(得分:4)

更新了小提琴。您在选择器与:hover http://jsfiddle.net/4Xxaf/1/

之间添加了空格

答案 1 :(得分:0)

删除代码中的空格

.downloadbtn:hover{
    background: green;
}