gpt4 book ai didi

CSS nth child - 1st/2nd - 3rd/4th 模式

转载 作者:行者123 更新时间:2023-12-02 07:05:21 25 4
gpt4 key购买 nike

我有一个包含大约 20 个元素的 ul,需要使用第 n 个子选择器来定位交替对的元素。

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!

关于CSS nth child - 1st/2nd - 3rd/4th 模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13203838/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com