Changing CSS for last
  • 前端 未结 10 1549
    暗喜
    暗喜 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:33

      I usually do this by creating a htc file (ex. last-child.htc):

      
      
      

      And call it from my IE conditional css file with:

      ul { behavior: url("/javascripts/htc/last-child.htc"); }

      Whereas in my main css file I got:

      ul li:last-child,
      ul li.last-child {
        /* some code */
      }
      

      Another solution (albeit slower) that uses your existent css markup without defining any .last-child class would be Dean Edwards ie7.js library.

    提交回复
    热议问题