2013-04-24 76 views
0

HTMLIE无法正常工作渐变效果

<div></div> 

CSS

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

有谁知道如何让IE的渐变效果的工作?

我也应用了filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00f', endColorstr='#fff'); ,但它在ie中的工作方式不同。你可以在你的测试页面看到它,复制并粘贴,然后看到它们之间的差异。 IE有深沉的色彩。

回答

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

试试这个

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

+1为您先回答。 – 2013-04-24 04:27:25