Add a pipe separator after items in an unordered list unless that item is the last on a line

前端 未结 10 1057
逝去的感伤
逝去的感伤 2020-11-29 18:54

Is it possible to style this html ...

  • Dogs
  • Cats
  • Lions
  • Tig
10条回答
  •  死守一世寂寞
    2020-11-29 19:11

    Before showing the code, it's worth mentioning that IE8 supports :first-child but not :last-child, so in similar situations, you should use the :first-child pseudo-class.

    Demo

    #menu{
        list-style: none;
    }
    #menu li{
        display: inline;
        padding: 0 10px;
        border-left: solid 1px black;
    }
    #menu li:first-child{
        border-left: none;
    }

提交回复
热议问题