IE中的按钮颜色不会改变。 (背景图像:线性渐变)

时间:2013-05-29 18:30:47

标签: html css internet-explorer

我只是想知道为什么在IE中按钮是灰色的,然后当你将鼠标悬停在按钮上变为蓝色时,它应该是蓝色,然后当悬停在它上面时会变成深蓝色。

我已经在其他浏览器中使用它,但我无法弄清IE的代码。

提前致谢。

这是CSS:

#mc_embed_signup .button {
background-image: linear-gradient(center top , rgb(95, 176, 244), rgb(70, 130, 180));
background-image: -o-linear-gradient(center top , rgb(95, 176, 244), rgb(70, 130, 180));
background-image: -moz-linear-gradient(center top , rgb(95, 176, 244), rgb(70, 130, 180));
background-image: -webkit-linear-gradient(center top , rgb(95, 176, 244), rgb(70, 130,     180));
background-image: -ms-linear-gradient(center top , rgb(95, 176, 244), rgb(70, 130, 180));


background-image: -webkit-gradient(
linear,
left bottom,
left top,
color-stop(1, rgb(95, 176, 244)),
color-stop(1, rgb(70, 130, 180))
);}

这是按钮的HTML:

<input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe"  class="button">

它实际上存在于http://www.housebuyfast.co.uk的页脚中。这是“立即加入我们的邮件列表”下的订阅按钮。

3 个答案:

答案 0 :(得分:2)

IE9及更早版本不支持标准CSS渐变。

IE10支持它们,并且您的代码在IE10中应该可以正常工作(除非它处于兼容模式)。

如果你需要在IE9或更早版本中使用渐变,你有几个选择:

  1. 使用IE专有的-ms-filter样式。像这样:

    -ms-filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#444444', EndColorStr='#999999');
    
  2. 使用像CSS3Pie这样的polyfill脚本。这将允许标准CSS渐变在较旧的IE版本中工作。

答案 1 :(得分:0)

这是因为您使用的IE版本不支持渐变。

更多信息:http://msdn.microsoft.com/en-us/library/cc351024(VS.85).aspx

基本上它在IE10之前不受支持,但正如其他海报所指出的那样,有其他选择。

答案 2 :(得分:0)

使用CSS3PIE使Internet Explorer 6-9能够呈现几个最有用的CSS3装饰功能http://css3pie.com/