February 27, 2012

How to add a colons (:) between inline list elements?

Question by DexyOnline

Is there anyway to add colons between inline list elements?

Example:

home : blog : contact

Answer by Sarfraz

You can use :after and content:

/* add : after each li */
#ul li:after{
  content:":"
}  

/* remove from last one */
#ul li:last-child:after{
  content:""
}

Working Example

Answer by Starx

The proper ways would be these

ul li:not(:last-child):after{
  content:":"
}

Author: Nabin Nepal (Starx)

Hello, I am Nabin Nepal and you can call me Starx. This is my blog where write about my life and my involvements. I am a Software Developer, A Cyclist and a Realist. I hope you will find my blog interesting. Follow me on Google+

...

Please fill the form - I will response as fast as I can!