Changing CSS for last
  • 前端 未结 10 1550
    暗喜
    暗喜 2020-11-30 22:30

    I am wondering if there is some way to change a CSS attribute for the last li in a list using CSS. I have looked into using :last-child, but this

    10条回答
    •  春和景丽
      2020-11-30 23:28

      :last-child is CSS3 and has no IE support while :first-child is CSS2, I believe the following is the safe way to implement it using jquery

      $('li').last().addClass('someClass');
      

    提交回复
    热议问题