Combining CSS Pseudo-elements, “:after” the “:last-child”

后端 未结 8 1335
时光说笑
时光说笑 2020-12-22 20:18

I want to make \"grammatically correct\" lists using CSS. This is what I have so far:

The

  • tags are displayed horizontally with commas after t
  • 8条回答
    •  北荒
      北荒 (楼主)
      2020-12-22 20:57

      This works :) (I hope multi-browser, Firefox likes it)

      li { display: inline; list-style-type: none; }
      li:after { content: ", "; }
      li:last-child:before { content: "and "; }
      li:last-child:after { content: "."; }
      
        
          
      • One
      • Two
      • Three

    提交回复
    热议问题