Created
September 27, 2012 16:46
-
-
Save twosixcode/3795046 to your computer and use it in GitHub Desktop.
Clean way to add icon font using :before pseudoclass
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
/* Use the following CSS code if you want to have a class per icon */ | |
[class^="icon-"]:before, | |
[class*=" icon-"]:before, | |
[class^="icon-"]:after, | |
[class*=" icon-"]:after { | |
font-family: 'Pictos'; | |
font-style: normal; | |
speak: none; | |
} | |
.icon-comment:before { | |
content: "\77"; | |
} | |
/* CREDIT: http://icomoon.io/#toHome */ |
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
<!-- So on a comments link for example, instead of having something that looked like: --> | |
<a href="#comments"><span class="icon">w</span> Comments</a> | |
<!-- We could instead do a much cleaner: --> | |
<a href="#comments" class="icon-comments">Comments</a> | |
<!-- This automatically adds a "w", using the unicode character number, before anything with a class of .icon-comment. --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment