IE8 css 选择器 [英] IE8 css selector
本文介绍了IE8 css 选择器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
要仅在 IE 浏览器中定位元素,我将使用
To target elements only in IE browsers i'll use
IE6:
* html #nav li ul {
left: -39px !important;
border: 1px solid red;
}
IE7:
*+html #nav li ul {
left: -39px! important;
}
有谁知道如何针对 IE8?
Does anyone know how to target IE8?
推荐答案
我不打算讨论是否应该使用这种方法,但这会让你为 IE8-9 设置特定的 css 属性only(注意:它不是一个选择器,所以和你问的有点不同):
I'm not going to get in a debate about whether or not this method should be used, but this will let you set specific css attributes for IE8-9 only (note: it is not a selector, so a bit different than what you asked):
在每个 css 声明后使用 ' /',所以:
Use ' /' after each css declaration, so:
#nav li ul {
left: -39px / !important;
}
为了建立另一个答案,您可以这样做以将各种样式分配给 IE6、IE7 和 IE8:
And to build off another answer, you can do this to assign variou styles to IE6, IE7, and IE8:
#nav li ul {
*left: -7px !important; /* IE 7 (IE6 also uses this, so put it first) */
_left: -6px !important; /* IE 6 */
left: -8px / !important; /* IE 8-9 */
}
来源:http://dimox.net/personal-css-hacks-for-ie6-ie7-ie8/
这篇关于IE8 css 选择器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文