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.
使用 css :nth-child 伪选择器。我如何选择每 7n 个项目,包括第一个项目(即 0 索引处的项目)。 例如:
我试过 :nth-child(7n) 但它与第一项不匹配。
采用:
:nth-child(6n+1) { ... }
工作示例
您可以混合编写两种或多种样式:
:first-child, :nth-child(7n) { . . . }
这样就可以了!