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

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

Is it possible to style this html ...

  • Dogs
  • Cats
  • Lions
  • Tig
10条回答
  •  暖寄归人
    2020-11-29 19:04

    One solution is to style the left border like so:

    li { display: inline; }
    li + li {
      border-left: 1px solid;
      margin-left:.5em;
      padding-left:.5em;
    }
    

    However, this may not give you desirable results if the entire lists wraps, like it does in your example. I.e. it would give something like:

    foo | bar | baz
     | bob | bill
     | judy
    

提交回复
热议问题