我有九组配色方案,我想将它们应用于一个div序列。在前九个阶段使用:nth-child(1), :nth-child(2)...可以工作,但我希望在那之后重复该序列,并且我不能理解(3n+2)表示法……我想我明白了,但我似乎无法说服它去做我想做的事情。
这是可能的吗,或者我应该在写出每个div时只对它们应用一个类?
发布于 2011-08-26 22:56:09
如果您的意思是需要对每九个连续的元素应用不同的规则,则必须使用这九个选择器:
:nth-child(9n+1)
:nth-child(9n+2)
:nth-child(9n+3)
:nth-child(9n+4)
:nth-child(9n+5)
:nth-child(9n+6)
:nth-child(9n+7)
:nth-child(9n+8)
:nth-child(9n+9) /* Or :nth-child(9n) */https://stackoverflow.com/questions/7206573
复制相似问题