選擇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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章