CSS Last Odd Child?

前端 未结 5 1640
予麋鹿
予麋鹿 2020-12-07 17:50

I have an unordered list, which can contain either an even or odd number of items. I\'m looking for a CSS-only way to remove the border from the last 2 li tags

5条回答
  •  一生所求
    2020-12-07 18:15

    Another alternative:

    li:last-child:not(:nth-child(odd))
    

    Here is a fiddle: http://jsfiddle.net/W72nR/

提交回复
热议问题