Last active
August 29, 2015 14:05
-
-
Save wilsonpage/b3e4aabf0483ac8f83ff to your computer and use it in GitHub Desktop.
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
.icon-foo:before { | |
font-family: 'icons'; | |
content: 'foo' | |
} | |
<span class="icon-foo"></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
[data-icon]:before { | |
font-family: 'icons'; | |
content: attr(data-icon); | |
} | |
<span data-icon="foo"></span> |
Depends on where you want to manage the icon content: in CSS or in HTML?
Really, the best improvement you can make to your icon font implementation is to add a font load check. I talk about this here: https://github.com/zachleat/fontfaceonload and here https://speakerdeck.com/zachleat/bulletproof-font-icons
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@wilsonpage colour them with sprites, or use foreground svg, and css. depends on browser requirements