如何只为IE申请课程? [英] How to apply class only for IE?
本文介绍了如何只为IE申请课程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在CSS中有这个类,需要在IE时更改它.我要删除 padding-bottom
.我怎样才能做到这一点?
I have this class in CSS and i need to change it when its IE. I want to remove padding-bottom
. How can I do that?
我不想添加另一个CSS文件,我只想更改一个类中的一个属性.
I don't want to add another CSS file, I want to change only one property in one class.
.container-wrapp{
float: left;
position: relative;
width: 100%;
padding-bottom:100px;
height: 100%;
}
我尝试了这个但没有成功:
I tried this but without success:
<!--[if IE]>
<style type="text/css">
.container-wrapp{
float: left;
position: relative;
width: 100%;
height: 100%;
}
</style>
<![endif]-->
推荐答案
对于IE10 +,您可以执行以下操作:
For IE10+ you can do the following:
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
.container-wrapp{padding-bottom:0;}
}
演示小提琴(请注意,该文本仅在IE 10+中为红色)
Demo Fiddle (Note that the text is red only in IE 10+)
@media all and (-ms-high-contrast: none),
(-ms-high-contrast: active) {
.red {
color: red
}
}
<div class="red">text</div>
NB:使用这类黑客通常是不受欢迎的.谨慎使用.
NB: Using hacks like these are generally frowned upon. Use with caution.
这篇关于如何只为IE申请课程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文