css僞類選擇器 nth-child( ) 使用

製作中遇到需求: 點擊「更多」按鈕展開標籤 思路:使用css僞類nth-child()選擇之後元素隱藏。 以下蒐集關於nth-child用法: 1、正方向範圍 li:nth-child(n+5)      選中第5個及之後的元素 2、負方向範圍 li:nth-child(-n+8)     選中第8個及之前的元素 3、前後限制範圍 li:nth-child(n+5):nth-child(-n+8)
相關文章
相關標籤/搜索