close

ul中的li,共12個

1.想要選取此ul中第1個到第4個li

ul li:nth-child(-n+4)

2.想要選取此ul中第5個到第8個li

ul li:nth-child(n+3):nth-child(-n+8)

3.想要選取此ul中第9個到第12個li

ul li:nth-child(n+9)

參考:

CSS選擇器給子節點指定一個範圍

使用css3-nth-childn-選取器詳解

 

arrow
arrow
    文章標籤
    :nth-child css選擇器
    全站熱搜

    Brands 發表在 痞客邦 留言(0) 人氣()