html - 悬停时按钮背景不变

标签 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/

最佳答案

更新 fiddle 。您在选择器和 :hover 之间添加了一个空格 http://jsfiddle.net/4Xxaf/1/

关于html - 悬停时按钮背景不变,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22328275/

相关文章:

javascript - 需要一种方法来根据请求禁用 HTML 框架

javascript - 如何使用 AngularJS 或 CoffeeScript 在 ng-click 上重定向到另一个页面?

html - Css 和 html 2 div 在一行然后去下一行

html - 当窗口宽度变小时图像从容器中出来

css - Chrome 无法正确呈现页面。它在 Firefox/IE 中完美运行

html - 在图像上覆盖 div - bootstrap

android - 如何在android中点击相同框架布局中的两个重叠按钮

html - CSS 双边框,第二个边框一直延伸到元素的顶部

java - 处理填充问题的 list

html - 使用 anchor 提交表单安全吗?