【发布时间】:2012-12-09 00:51:30
【问题描述】:
我正在使用以下代码:
.c-1:first-child, .c-2:first-child, .c-1:nth-child(4n+1) { margin-left: 0; }
效果很好,但我需要为不支持 nth-child 的浏览器(如 IE8)模仿这一点。
我已经尝试使用这个 jQuery 代码来添加一个类,但是没有任何反应,这个代码对吗?
// Support nth child in IE8
$('.c-1:first-child').addClass('remove');
$('.c-2:first-child').addClass('remove');
$('.c-1:nth-child(4n+1)').addClass('remove');
【问题讨论】:
-
相关Link
标签: jquery css internet-explorer-8 css-selectors