简体   繁体   English

我的CSS渐变不适用于IE 9或更低版本

[英]My CSS gradient isnt working in IE 9 or below

I have a CSS gradient for an image that doesn't work in IE 9 or below. 我有一个CSS渐变的图像,在IE 9或更低版本中不起作用。 I tried adding adding a height:100%; 我尝试添加一个高度:100%; because I saw that helped someone else but it still didn't affect mine. 因为我看到它帮助了别人,但它仍然没有影响我的。 The image is the Sign Up button, and my URL is http://ht.io-web.com/ . 图像是注册按钮,我的URL是http://ht.io-web.com/ Here is the CSS 这是CSS

.white {
background: -moz-linear-gradient(center top , #FFFFFF, #DEDCDC) repeat scroll 0 0 transparent;
border: medium none #DEDCDC;
color: #85B700;
margin-left: 5px;}

gradients for ie: 渐变为ie:

filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#cccccc', endColorstr='#000000');

gradients for webkit browsers: webkit浏览器的渐变:

background: -webkit-gradient(linear, left top, left bottom, from(#ccc), to(#000));

CSS Gradients are not available in IE9 and below without Microsoft scripting (as noted by Keith). 如果没有Microsoft脚本(如Keith所述),IE Gradients在IE9及以下版本中不可用。

http://caniuse.com/#search=linear-gradient http://caniuse.com/#search=linear-gradient

And your CSS code specifically use the Mozilla browser prefix so it will only work in Firefox browsers. 并且您的CSS代码专门使用Mozilla浏览器前缀,因此它只能在Firefox浏览器中使用。

You can use "-webkit-" and "-o-" to target Safari/Chrome and Opera browsers (as noted in CanIUse.com) but they have different parameters I believe. 您可以使用“-webkit-”和“-o-”来定位Safari / Chrome和Opera浏览器(如CanIUse.com中所述),但我相信它们具有不同的参数。

IE doesn't support CSS gradients -- not even in IE9. IE不支持CSS渐变 - 即使在IE9中也是如此。

However, there is a javascript hack called CSS3Pie that can solve this for you. 但是,有一个名为CSS3Pie的javascript hack可以为你解决这个问题。

See http://www.css3pie.com/ http://www.css3pie.com/

Add this script to your site, and IE will be able to process CSS gradients. 将此脚本添加到您的站点,IE将能够处理CSS渐变。

(css3pie also does other CSS stuff too, like rounded corners, but IE9 supports them already, so those hacks only apply to IE8 and below) (css3pie也会做其他CSS的东西,比如圆角,但IE9已经支持它们,所以这些黑客只适用于IE8及以下版本)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM