Created
September 22, 2014 09:41
-
-
Save rijk/aae980d8b8dcb42822f3 to your computer and use it in GitHub Desktop.
Comma-seperated list with just CSS/LESS
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.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