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> |
@wilsonpage colour them with sprites, or use foreground svg, and css. depends on browser requirements
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
One limitation of icon fonts is that if a user with accessibility needs forces their own font e.g. a dyslexic uses a special font, then the desired icons won't appear and will be replaced with what ever glyph matches in the user font