2013-04-24 74 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