Skip to content

Instantly share code, notes, and snippets.

@rijk
Created September 22, 2014 09:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rijk/aae980d8b8dcb42822f3 to your computer and use it in GitHub Desktop.
Save rijk/aae980d8b8dcb42822f3 to your computer and use it in GitHub Desktop.
Comma-seperated list with just CSS/LESS
ul.comma {
display: inline;
margin: 0;
padding: 0;
li {
list-style: none;
display: inline;
&:after {
content: ", ";
}
&:last-child:after {
content: ""
}
}
&.verbose {
li:nth-last-child(2):after {
content: " and "
}
// optional, different ending after longer lists
li:nth-last-child(3) + li:after {
content: " and of course "
}
}
&.dot {
li:last-child:after {
content: "."
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment