Skip to content

Instantly share code, notes, and snippets.

@martinwolf
Last active December 17, 2015 08:59
Show Gist options
  • Save martinwolf/5583648 to your computer and use it in GitHub Desktop.
Save martinwolf/5583648 to your computer and use it in GitHub Desktop.
SCSS: Mixin: Web Font Icons
@font-face {
font-family: 'Icons';
src: url('../fonts/icons.woff') format('woff');
font-weight: normal;
font-style: normal;
}
@mixin icon($type, $pseudoElem, $display: block) {
&:#{$pseudoElem} {
display: $display;
color: inherit;
font-family: 'Icons';
@if $type == arrow_down {
content: 'J';
} @else if $type == arrow_up {
content: 'K';
} @else if $type == twitter {
content: 'B';
} @else if $type == facebook {
content: 'C';
}
}
span {
display: none;
}
}
<a href="http://twitter.com/_martinwolf" class="footer-social__icon footer-social__icon--twitter">
<span>Twitter</span>
</a>
.footer-social__icon--twitter {
@include icon(twitter, before);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment