How to style unordered lists in CSS as comma separated text

后端 未结 6 2052
时光说笑
时光说笑 2020-12-08 06:10

I’m looking for a way to style an unordered list in XHTML with CSS such that it is rendered inline and the list items are separated by commas.

For example, the follo

6条回答
  •  借酒劲吻你
    2020-12-08 06:28

    Replace one your rule

    #taglist li:after {
        content: ", ";
    }
    

    with just another one

    #taglist li + li:before {
        content: ", ";
    }
    

    Pros:

    • One rule do all the work.
    • No rules for cancel previous rule,
    • IE8 Support

提交回复
热议问题