CSS Last Odd Child?

前端 未结 5 1643
予麋鹿
予麋鹿 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:04

    This works for me. Dynamically select the last odd child.

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

提交回复
热议问题