I have a list of strings, and I want to have commas after all but the last.
Here's an example UL:
<ul class="my_list"> <li class="my_list_entry">Entry 1</li> <li class="my_list_entry">Entry 2</li> <li class="my_list_entry">Entry 3</li> </ul>
And here's the CSS I'm using to produce a comma-separated list:
.my_list { list-style-type: none; padding: 0; margin: 0; } .my_list li { display: inline } .my_list li:after { content: ", "; }
Which generates commas after ALL the lis, as you'd expect.
Now you would think there was some way to use :not(last-child) on that last one to do this, but I can't seem to get any variation of it to work. Am I wrong in thinking that is a valid way of accomplishing this?
Thanks!
-Jack