【发布时间】:2013-06-06 22:59:04
【问题描述】:
在我的项目中,我正在尝试使用 selectivizr 使以下 css 在 IE8 中工作
thead>tr:first-child>th:last-child {
color: red;
}
tbody>tr:first-child>td:last-child {
color: red;
}
如Selectivizr网站所述,我在JSFiddle的“外部资源”中添加了以下代码。
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<!--[if (gte IE 6)&(lte IE 8)]>
<script type="text/javascript" src="https://github.com/keithclark/selectivizr/blob/master/selectivizr.js"></script>
<noscript><link rel="stylesheet" href="[fallback css]" /></noscript>
<![endif]-->
我仍然无法让 first-child 和 last-child 伪选择器在 IE8 中工作。
我正在使用以下代码将所有版本的 IE 切换到 IE8。 (仅供参考)。
<meta http-equiv="X-UA-Compatible" content="IE=8" >
【问题讨论】:
-
看起来
last-child是在 IE>=9 中实现的,因此它违反了包含它的整个规则。 -
@Teemu 我将上述 selectivizr 脚本仅包含到 IE8
-
现在我有两个疑问。 1) 我是否在 jsfiddle 中正确包含了脚本标签? 2)
[fallback css]里面应该是什么? -
您可以删除后备。它用于在浏览器中禁用 JS 时。您接受的答案不是这个问题的答案:为什么 selectivizr 不适用于 jQuery 1.10.x ?你应该说清楚,因为我来这里是为了寻找这个问题,而接受的答案不是你自己问题的答案。
标签: javascript jquery html css selectivizr