Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 ul 包含大约 20 个元素,需要使用第 n 个子选择器来定位交替对的元素。
IE
1st/2nd - 5th/6th - 9th/10th 3rd/4th - 7th/8th - 11th/12th
在这里试试这个:
ul li:nth-child(4n+4), ul li:nth-child(4n+3) { color:red; }
这个不支持IE8!