css - IE 8 和 9 以及 CSS 渐变问题

标签 css internet-explorer

如果你去http://www.aerlawgroup.com在 IE 8 或 9 上,您可以看到 CTA 按钮显示为奇怪的红色,而不是预期的橙色渐变。

有谁知道如何修复它以使其按预期呈现?谢谢。

   .button2 {
    display: inline-block;
    text-align: center;
    vertical-align: middle;
    padding: 8px 24px;
    border: 1px solid #a56317;
    border-radius: 1px;
    background: #992828;
    background: -webkit-gradient(linear, left top, left bottom, from(#ffb14a), to(#c76e08));
    background: -moz-linear-gradient(top, #ffb14a, #c76e08);
    background: linear-gradient(to bottom, #ffb14a, #c76e08);
    text-shadow: #764711 1px 1px 1px;
    font: normal normal bold 18px arial;
    color: #ffffff;
    text-decoration: none;
    /*top: 248px;
    left: 97px;*/
}
.button2:hover,
.button2:focus {
    border: 1px solid #ec8d21;
    background: #992828;
    background: -webkit-gradient(linear, left top, left bottom, from(#ffd459), to(#ef840a));
    background: -moz-linear-gradient(top, #ffd459, #ef840a);
    background: linear-gradient(to bottom, #ffd459, #ef840a);
    color: #ffffff;
    text-decoration: none;
}
.button2:active {
    background: #982727;
    background: -webkit-gradient(linear, left top, left bottom, from(#996a2c), to(#c76e08));
    background: -moz-linear-gradient(top, #996a2c, #c76e08);
    background: linear-gradient(to bottom, #996a2c, #c76e08);
}

最佳答案

对于 IE9-,background:linear-gradient 或特定于供应商的语法将不起作用,因为那是 CSS3,您需要使用他们的老式专有语法:

filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffb14a', endColorstr='#c76e08',GradientType=0 );

将它放在该按钮的 CSS 分配的底部,您应该是安全的。如果您仍然看不到它,请添加:

zoom:1;

对于非 block 元素,有时这对于梯度生效是必要的。

关于css - IE 8 和 9 以及 CSS 渐变问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20871631/

相关文章:

javascript - 更改滚轮一勾所覆盖的滚动距离

javascript - 选择未在 IE 中显示的选项

Bootstrap d-flex 中的 Jquery 数据表在 Internet Explorer 中溢出父级

javascript - 框在悬停时可见,然后在将鼠标移动到另一个框后保持可见

html - CSS3 动画和悬停 - 一起工作?

html - Internet Explorer 不会增加非同级 <li> 元素的数量

html - 如何在 Bootstrap 菜单栏中添加大型菜单

jquery - IE7 Jquery 位置 : Relative

html - IE8 div对齐问题

javascript 在部署的 IE 与 VS 调试器、ff、chrome 等中的工作方式不同