在IE上禁用CSS规则 [英] Disable a css rule on IE
本文介绍了在IE上禁用CSS规则的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道您是否知道在客户端具有ie时启用或禁用css规则的方法.
i wonder if you know a way to able or disable a css rule when client has ie.
我有这种风格
#number_one{
background-image: url("../img/pins/1.png");
top: 250px;
left: 115px;
filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../img/pins/1.png',sizingMethod='scale');
-ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../img/pins/1.png',sizingMethod='scale')";
}
我希望背景图片在除IE之外的所有浏览器上都能正常工作,因为过滤器将执行背景图片工作.
I want background-image to work on all browser except IE, becuase Filters will do the background-image job.
有人知道如何解决这个问题吗?非常感谢.
Anyone know how to solve this? Thanks a lot.
推荐答案
一种简单的方法(不需要多个单独的样式表(顺便说一句,也可以使用))是用以下方法替换<html>
标记:
An easy way (without the need for multiple separate stylesheets [which works too, by the way]) is to replace your <html>
tag with this:
<!--[if IE]>
<html class="ie">
<![endif]-->
<!--[if !IE]>
<html class="normal">
<![endif]-->
在您的CSS中,使用此代码仅定位IE:
And in your CSS, use this to target only IE:
html.ie #number_one{
background-image:none;
}
或使用它来定位除IE之外的所有浏览器:
Or use this to target all browsers except IE:
html.normal #number_one{
background-image: url("../img/pins/1.png");
top: 250px;
left: 115px;
filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../img/pins/1.png',sizingMethod='scale');
-ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../img/pins/1.png',sizingMethod='scale')";
}
这篇关于在IE上禁用CSS规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文