Skip to content
Home » Blog » Add content using CSS

Add content using CSS

I recently faced a problem in a website, where I have to add a separtor after each li ends. And the speartor should not come for last li
I learned this can be achieved through CSS.

Let us say out Menu structucture is like this.
{code type=html}

{/code}

My css for this menu is
{code type=css}
.menu li:after{content: “|”;}
.menu li:last-child:after{content: “”;}
{/code}
As you can see the “after” and content did the job. For finding the last li in the list “last-child” is used.

Hope this will help you some where.

Leave a Reply

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