如何将CSS效果应用于div的前10个<a>
标签?将CSS效果仅应用于div的前10 标签
这是我的做法,但我相信,必须有一个更好的解决方案:
a:nth-child(1), a:nth-child(2), a:nth-child(3), a:nth-child(4),
a:nth-child(5), a:nth-child(6), a:nth-child(7), a:nth-child(8),
a:nth-child(9), a:nth-child(10){ color:#4faacb; }
我很确定有一个范围选项可用。我只是不确定目前有什么样的浏览器支持。 – 2013-04-29 13:31:18
为什么不使用JS循环将类应用于前10个链接,然后将该类用作选择器? – 11684 2013-04-29 13:33:30
a:nth-child(-n + 11){color:#4faacb} – 2013-04-29 13:34:11