css: add text before or after

Use :before and :after pseudo elements with CSS property content.

eg, to separate a list of items with ‘|’:

li:after { content: ' | '; }
li:last-child:after { content: ''; }

Note line 2: no separator after the last item in the list.

Leave a Reply

Your email address will not be published. Required fields are marked *