对于课堂上的每个其他奇数div,CSS甚至都很奇怪

Sha*_*awn 8 css css-selectors

我有一个水平行的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){
Run Code Online (Sandbox Code Playgroud)

但无法弄清楚:(

lui*_*bal 13

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

既然你想要1,5,9,你应该试试 :nth-child(4n + 1)