我怎么能不在ie6上显示css投影?

时间:2022-08-22 21:30:42

I want to know if I can ignore my css drop shadow on ie6 without using conditional statements to filter the css.

我想知道我是否可以忽略ie6上的css投影,而不使用条件语句来过滤css。

here is my current css:

这是我目前的CSS:

/* Drop shadow */
-ms-filter: "progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=135, Color='#000000')";
filter: progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=135, Color='#000000');
box-shadow: 0px 10px 15px rgba(0, 0, 0, 0.7);
-moz-box-shadow: 0px 10px 15px rgba(0, 0, 0, 0.7);
-o-box-shadow: 0px 10px 15px rgba(0, 0, 0, 0.7);
-webkit-box-shadow: 0px 10px 15px rgba(0, 0, 0, 0.7);

Maybe -ms-filter-ie6: none or something :P along those lines

也许-ms-filter-ie6:无或者:P沿着这些线

5 个解决方案

#1


3  

Adding the following line below your -ms-filter: line should work:

在-ms-filter:行下面添加以下行应该有效:

* html -ms-filter: "progid:DXImageTransform.Microsoft.Shadow(enabled=false)";

The * html is read only by IE6. But that is a CSS hack, which is very bad practice. You should use conditionals instead.

* html仅由IE6读取。但这是一个CSS黑客,这是非常糟糕的做法。你应该使用条件。

#2


2  

Use an IE-Only CSS Conditional Comment that disables the proprietary filter for IE6/Win:

使用IE-Only CSS条件注释禁用IE6 / Win的专有过滤器:

<!--[if IE 6]>
    <style type="text/css">
        .drop-shadow {
            filter: progid:DXImageTransform.Microsoft.Shadow(enabled='0');
        }
    </style>
<![endif]-->

The 'enabled' filter attribute is a boolean that expects a true or false value to enable or disable the filter:

'enabled'过滤器属性是一个布尔值,需要true或false值来启用或禁用过滤器:

0 = false (Filter is disabled)
1 = true (Default value. Filter is enabled)

0 = false(禁用过滤器)1 = true(默认值。启用过滤器)

#3


1  

IE6 only knows about filter, it won't recognise the -ms-filter style, so dropping filter would do the trick. The downside is that this would also kill it for IE7.

IE6只知道过滤器,它不会识别-ms-filter样式,所以删除过滤器就可以了。缺点是这也会为IE7杀死它。

#4


1  

You can use te /**/ hack.

你可以使用te / ** / hack。

filter/**/: progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=135, Color='#000000');

It should be ignored by ie6, but I don't have ie6 to test it.

它应该被ie6忽略,但我没有ie6来测试它。

As Justin Satyr said it's a hack and you should use conditional comments.

正如贾斯汀萨特所说,这是一个黑客,你应该使用条件评论。

#5


1  

I've been putting the conditionals on the <html> tag:

我一直把条件放在标签上:

<!DOCTYPE HTML>
<!--[if lt IE 7 ]>  <html class="ie ie6"><![endif]-->
<!--[if gte IE 7 ]> <html class="ie"><![endif]-->
<!--[if ! IE ]><!--><html class="notie"><!--<![endif]-->
<head>
    ...

And then in the style sheet one can do (you only need one style sheet now, and no inline styles in the html)

然后在样式表中可以做(你现在只需要一个样式表,而html中没有内联样式)

.ie6 .drop-shadow
{
    filter:none; /* or whatever */
}

If you need different code for other IEs you can add more conditionals. I've had one project where IE6, IE7, IE8 and IE9 all behaved differently for at least one item (but FF, Chrome and Safari were close), so there was five different <html> tags.

如果您需要其他IE的不同代码,您可以添加更多条件。我有一个项目,其中IE6,IE7,IE8和IE9对于至少一个项目都表现不同(但FF,Chrome和Safari都很接近),所以有五个不同的标签。

If you use DreamWeaver I've heard you'll need the same comments around the </html> as well.

如果你使用DreamWeaver,我听说你也需要围绕 的相同评论。

If you need different code for other browsers, you would have to use jQuery or similar to add classes: like $('html').addClass('ff4'); though things might be unexpected if js is not enabled.

如果你需要为其他浏览器使用不同的代码,你必须使用jQuery或类似的方法来添加类:如$('html')。addClass('ff4');虽然如果没有启用js,可能会出现意外情况。

#1


3  

Adding the following line below your -ms-filter: line should work:

在-ms-filter:行下面添加以下行应该有效:

* html -ms-filter: "progid:DXImageTransform.Microsoft.Shadow(enabled=false)";

The * html is read only by IE6. But that is a CSS hack, which is very bad practice. You should use conditionals instead.

* html仅由IE6读取。但这是一个CSS黑客,这是非常糟糕的做法。你应该使用条件。

#2


2  

Use an IE-Only CSS Conditional Comment that disables the proprietary filter for IE6/Win:

使用IE-Only CSS条件注释禁用IE6 / Win的专有过滤器:

<!--[if IE 6]>
    <style type="text/css">
        .drop-shadow {
            filter: progid:DXImageTransform.Microsoft.Shadow(enabled='0');
        }
    </style>
<![endif]-->

The 'enabled' filter attribute is a boolean that expects a true or false value to enable or disable the filter:

'enabled'过滤器属性是一个布尔值,需要true或false值来启用或禁用过滤器:

0 = false (Filter is disabled)
1 = true (Default value. Filter is enabled)

0 = false(禁用过滤器)1 = true(默认值。启用过滤器)

#3


1  

IE6 only knows about filter, it won't recognise the -ms-filter style, so dropping filter would do the trick. The downside is that this would also kill it for IE7.

IE6只知道过滤器,它不会识别-ms-filter样式,所以删除过滤器就可以了。缺点是这也会为IE7杀死它。

#4


1  

You can use te /**/ hack.

你可以使用te / ** / hack。

filter/**/: progid:DXImageTransform.Microsoft.Shadow(Strength=4, Direction=135, Color='#000000');

It should be ignored by ie6, but I don't have ie6 to test it.

它应该被ie6忽略,但我没有ie6来测试它。

As Justin Satyr said it's a hack and you should use conditional comments.

正如贾斯汀萨特所说,这是一个黑客,你应该使用条件评论。

#5


1  

I've been putting the conditionals on the <html> tag:

我一直把条件放在标签上:

<!DOCTYPE HTML>
<!--[if lt IE 7 ]>  <html class="ie ie6"><![endif]-->
<!--[if gte IE 7 ]> <html class="ie"><![endif]-->
<!--[if ! IE ]><!--><html class="notie"><!--<![endif]-->
<head>
    ...

And then in the style sheet one can do (you only need one style sheet now, and no inline styles in the html)

然后在样式表中可以做(你现在只需要一个样式表,而html中没有内联样式)

.ie6 .drop-shadow
{
    filter:none; /* or whatever */
}

If you need different code for other IEs you can add more conditionals. I've had one project where IE6, IE7, IE8 and IE9 all behaved differently for at least one item (but FF, Chrome and Safari were close), so there was five different <html> tags.

如果您需要其他IE的不同代码,您可以添加更多条件。我有一个项目,其中IE6,IE7,IE8和IE9对于至少一个项目都表现不同(但FF,Chrome和Safari都很接近),所以有五个不同的标签。

If you use DreamWeaver I've heard you'll need the same comments around the </html> as well.

如果你使用DreamWeaver,我听说你也需要围绕 的相同评论。

If you need different code for other browsers, you would have to use jQuery or similar to add classes: like $('html').addClass('ff4'); though things might be unexpected if js is not enabled.

如果你需要为其他浏览器使用不同的代码,你必须使用jQuery或类似的方法来添加类:如$('html')。addClass('ff4');虽然如果没有启用js,可能会出现意外情况。