CSS 过滤器:progid:DXImageTransform.Microsoft.gradient 在 ie7 中不起作用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7131356/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 01:21:31  来源:igfitidea点击:

filter: progid:DXImageTransform.Microsoft.gradient is not working in ie7

cssinternet-explorerinternet-explorer-7

提问by Pavan Kumar

I want to apply a gradient background color to my div.

我想对我的div.

For IE I have used the property:

对于 IE,我使用了该属性:

filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fad59f', endColorstr='#fa9907')

It's working in IE9 and IE8. But not working in IE7.

它适用于 IE9 和 IE8。但不适用于 IE7。

What should I do to see in IE?

我应该怎么做才能在 IE 中看到?

Here is a JSFiddle: http://jsfiddle.net/xRcXL/2/

这是一个 JSFiddle:http: //jsfiddle.net/xRcXL/2/

回答by tw16

Having seen your fiddle in the comments the issue is quite easy to fix. You just need to add overflow:autoor set a specific height to your div. Live example: http://jsfiddle.net/tw16/xRcXL/3/

在评论中看到你的小提琴后,这个问题很容易解决。您只需要overflow:auto为您的div. 现场示例:http: //jsfiddle.net/tw16/xRcXL/3/

.Tab{
    overflow:auto; /* add this */
    border:solid 1px #faa62a;
    border-bottom:none;
    padding:7px 10px;
    background:-moz-linear-gradient(center top , #FAD59F, #FA9907) repeat scroll 0 0 transparent;
    background:-webkit-gradient(linear, left top, left bottom, from(#fad59f), to(#fa9907));
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#fad59f, endColorstr=#fa9907);    
    -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#fad59f, endColorstr=#fa9907)";
}

回答by feeela

You didn't specify a GradientType:

你没有指定一个GradientType

background: #f0f0f0; /* Old browsers */
background: -moz-linear-gradient(top, #ffffff 0%, #eeeeee 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(100%,#eeeeee)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #ffffff 0%,#eeeeee 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #ffffff 0%,#eeeeee 100%); /* Opera11.10+ */
background: -ms-linear-gradient(top, #ffffff 0%,#eeeeee 100%); /* IE10+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#eeeeee',GradientType=0 ); /* IE6-9 */
background: linear-gradient(top, #ffffff 0%,#eeeeee 100%); /* W3C */

source: http://www.colorzilla.com/gradient-editor/

来源:http: //www.colorzilla.com/gradient-editor/

回答by Anand Thangappan

This should work:

这应该有效:

background: -moz-linear-gradient(center top , #fad59f, #fa9907) repeat scroll 0 0 transparent;
 /* For WebKit (Safari, Google Chrome etc) */
background: -webkit-gradient(linear, left top, left bottom, from(#fad59f), to(#fa9907));
/* For Mozilla/Gecko (Firefox etc) */
background: -moz-linear-gradient(top, #fad59f, #fa9907);
/* For Internet Explorer 5.5 - 7 */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#fad59f, endColorstr=#fa9907);
/* For Internet Explorer 8 */
-ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#fad59f, endColorstr=#fa9907)";

Otherwise generate using the following link and get the code.

否则使用以下链接生成并获取代码。

http://www.colorzilla.com/gradient-editor/

http://www.colorzilla.com/gradient-editor/

回答by Chad

In testing IE7/8/9I was getting an ActiveXwarning trying to use this code snippet:

在测试IE7/8/9 时,我在ActiveX尝试使用此代码片段时收到警告:

filter:progid:DXImageTransform.Microsoft.gradient

After removing this the warning went away. I know this isn't an answer, but I thought it was worthwhile to note.

删除它后,警告消失了。我知道这不是答案,但我认为值得一提。