Using nth-child to style item 4 and onwards

前端 未结 2 460
孤独总比滥情好
孤独总比滥情好 2021-02-04 00:23

I have a list item where I\'d like the 4th item and onwards to have a different background-color.

I\'ve tried the following:

li:nth-child(4)         


        
2条回答
  •  自闭症患者
    2021-02-04 01:07

    You need to do this

    li:nth-child(n+5) { background-color:blue; }

    Example: http://jsfiddle.net/jasongennaro/2p4e9/1/

提交回复
热议问题