Created
September 18, 2010 23:00
-
-
Save jedsundwall/586144 to your computer and use it in GitHub Desktop.
CSS to add commas to items in an unordered list without leaving a comma hanging at the end of the list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ul.tags { | |
display: inline; | |
margin: 0; | |
padding: 0; | |
} | |
ul.tags li { | |
display: inline; | |
list-style: none; | |
margin: 0; | |
padding: 0; | |
} | |
ul.tags li:after { | |
content: ", "; | |
color: #aaa; | |
} | |
ul.tags li:last-child:after { | |
content: ""; | |
} |
thanks :)
great
You saved my day, dude! Thank you so much!
I had no idea people were commenting on this! I'm so glad this helped you all! <3
Or even like this:
ul.tags li:not(:first-child):not(:last-child):after {
content: ", ";
color: #aaa;
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks!