Select second last element with css

后端 未结 2 1971
日久生厌
日久生厌 2020-11-27 02:58

I already know of :last-child. But is there a way to select the div:

a
b
2条回答
  •  悲&欢浪女
    2020-11-27 03:22

    In CSS3 you have:

    :nth-last-child(2)
    

    See: https://developer.mozilla.org/en-US/docs/Web/CSS/:nth-last-child

    nth-last-child Browser Support:

    • Chrome 2
    • Firefox 3.5
    • Opera 9.5, 10
    • Safari 3.1, 4
    • Internet Explorer 9

提交回复
热议问题