Created
April 1, 2013 19:21
-
-
Save cemre/5287043 to your computer and use it in GitHub Desktop.
Rails to_sentence in pure CSS
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
<span class="join-as-sentence"> | |
<span class="item"> | |
David Yen | |
</span> | |
<span class="item"> | |
Hursh | |
</span> | |
<span class="item "> | |
Josh | |
</span> | |
<span class="item"> | |
Cemre | |
</span> | |
</span> |
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
.join-as-sentence { | |
.item:after { | |
content: ', '; | |
margin-left: -4px; | |
} | |
.item:nth-last-child(2):after { | |
margin-left: 0; | |
margin-right: 0; | |
content: ' and '; | |
} | |
.item:last-child:after { | |
content: ''; | |
margin-left: 0; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment