nth-child選擇器
:nth-child(2)
:nth-child(n)
:nth-child(n + 2)
:nth-child(2n)
:nth-child(2n + 1)
:nth-child(-n + 2)
:nth-child(n + 2):nth-child(-n + 4)
:nth-child(odd)
:nth-child(even)
:first-child
:last-child
學習如何使用 CSS nth-child 選擇器來選擇和應用特定元素。無論是選擇偶數元素、奇數元素,還是第一個元素,這篇文章將詳細介紹 nth-child 的各種用法,幫助你在網頁設計中創造出更豐富的效果。
:nth-child(n + 2)
:nth-child(2n + 1)
:nth-child(-n + 2)
:nth-child(n + 2):nth-child(-n + 4)
:nth-child(even)