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

后端 未结 8 1272
时光说笑
时光说笑 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 21:10

      An old thread, nonetheless someone may benefit from this:

      li:not(:last-child)::after { content: ","; }
      li:last-child::after { content: "."; }
      

      This should work in CSS3 and [untested] CSS2.

    提交回复
    热议问题