Skip to content

Instantly share code, notes, and snippets.

@zerolab
Forked from nathansmith/data_icon.css
Created December 14, 2011 20:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zerolab/1478343 to your computer and use it in GitHub Desktop.
Save zerolab/1478343 to your computer and use it in GitHub Desktop.
Terse Font Icons
a[data-icon]:before,
span[data-icon]:before {
font-family: 'Icon Font Here';
content: attr(data-icon);
}
/*
This would also work, but other web developers might
yell at you about "performance" which may/not matter:
*/
*[data-icon]:before {
font-family: 'Icon Font Here';
content: attr(data-icon);
}
<!-- Assuming "+" is your font's Add icon -->
<a data-icon="+" href="...">
Add
</a>
<!-- Assuming "D" is your font's Delete icon -->
<span data-icon="D">
Delete
</span>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment