adding bullets to inline elements (eg. links) while keeping line breaks nicely aligned

I had a narrow sidebar with a bunch of links that I wanted to format with bullets. This was done with the :before pseudo-element.
The problem was that when the links were long they were breaking into multiple lines. Changing the element a to display:block helped the alignment but the :before content was pushing the first line to the right.
The solution was to give the :before element a position:absolute which made it neutral to the links position:

The CSS for the links:

The CSS for the :before element (bullet):

Leave a Reply

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