This is useful for displaying menu elements and creating comma separated lists. Add the following code to your css/stylesheet. You may use unordered lists or ordered lists with similar results.
1 2 3 4 |
li { display: inline; list-style-type: none; } li:after { content: ", "; } li:last-child:before { content: "and "; } li:last-child:after { content: "."; } |
Keep in mind that :last-child
is not supported by IE8 and previous.
You can find a list of more CSS selectors at w3schools