I want to make "grammatically correct" lists using CSS. This is what I have so far:
The <li>
tags are displayed horizontally with commas after them.
li { display: inline; list-style-type: none; }
li:after { content: ", "; }
That works, but I want the "last-child" to have a period instead of a comma. And, if possible, I'd like to put "and" before the "last-child" as well. The lists I'm styling are generated dynamically, so I can't just give the "last-children" a class. You can't combine pseudo-elements, but that's basically the effect I want to achieve.
li:last-child li:before { content: "and "; }
li:last-child li:after { content: "."; }
How do I make this work?