jQuery去掉导航分割线的最后一条竖线

#top #navigation ul li
{
     
    float:left;
    width:120px;
    background:url(../images/navline.jpg) no-repeat 116px 16px;
    display:inline;
    text-align:center;
    overflow:hidden;
     
}
$(function () {
    $("#navigation li:last").css('background', 'none');//去掉导航最后一条竖线

});

或者
  $(".Nav ul li").each(function (i) {
        if (i == 0) $(this).css("background", "none")
    })

 

CSS3中可以使用

#top #navigation ul li:last-child{background:none;}

但是IE不支持

个人感觉最好用jQuery

原文地址:https://www.cnblogs.com/qigege/p/4759063.html