IE不起作用渐变效果

时间:2013-04-24 04:12:16

标签: html css gradient

HTML

<div></div>

CSS

div{
    width: 500px; 
    height: 500px; 
    background: linear-gradient(to top, #00f, #fff);
}

有谁知道如何制作渐变效果?

我还申请了filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00f', endColorstr='#fff'); ,但它在ie中的工作方式不同。您可以在测试页面中看到这一点,复制并粘贴,然后查看它们之间的不同之处。 IE有很深的颜色。

2 个答案:

答案 0 :(得分:2)

这是您应该拥有的跨浏览器解决方案:

background: rgb(255,255,255);
background: -moz-linear-gradient(top,  rgba(255,255,255,1) 0%, rgba(0,0,255,1) 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,1)), color-stop(100%,rgba(0,0,255,1)));
background: -webkit-linear-gradient(top,  rgba(255,255,255,1) 0%,rgba(0,0,255,1) 100%);
background: -o-linear-gradient(top,  rgba(255,255,255,1) 0%,rgba(0,0,255,1) 100%);
background: -ms-linear-gradient(top,  rgba(255,255,255,1) 0%,rgba(0,0,255,1) 100%);
background: linear-gradient(to bottom,  rgba(255,255,255,1) 0%,rgba(0,0,255,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#0000ff',GradientType=0 );

Here is a working example。另外,我建议使用一些梯度生成器。让您的生活更轻松。例如,尝试c olorzilla

答案 1 :(得分:1)

尝试这个

filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#0000ff', GradientType='0');
相关问题