选择CSS中的每N个元素 - Select every Nth element in CSS

问题:

Is it possible to select, say, every fourth element in a set of elements? 例如,是否可以选择一组元素中的每个第四个元素?

Ex: I have 16 <div> elements... I could write something like. 例如:我有16个<div>元素...我可以写类似的东西。

div:nth-child(4),
div:nth-child(8),
div:nth-child(12),
div:nth-child(16)

is there a better way to do this? 有一个更好的方法吗?


解决方案:

参考一: https://stackoom.com/question/EWhW
参考二: Select every Nth element in CSS
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章