gpt4 book ai didi

类(class)中每隔一个奇数 div 的 CSS 奇数

转载 作者:技术小花猫 更新时间:2023-10-29 11:06:47 24 4
gpt4 key购买 nike

我在水平行中有 div,它们都在同一个类中,如下所示:

1 2 3 4 5 6 7 8 9 10

我想要的是将 css 应用到每隔一个奇数列,所以1,5,9 等

我试过了

.myClass:nth-child(n+4) and
.myClass:nth-child(odd),.myClass:nth-child(odd){

但是想不出来:(

最佳答案

:nth-child(4n) 给我们 0、4、8 等。

因为你想要 1、5、9,你应该尝试 :nth-child(4n + 1)

关于类(class)中每隔一个奇数 div 的 CSS 奇数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19232650/

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