Last active
December 17, 2015 08:59
-
-
Save martinwolf/5583648 to your computer and use it in GitHub Desktop.
SCSS: Mixin: Web Font Icons
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
@font-face { | |
font-family: 'Icons'; | |
src: url('../fonts/icons.woff') format('woff'); | |
font-weight: normal; | |
font-style: normal; | |
} |
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
@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; | |
} | |
} |
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
<a href="http://twitter.com/_martinwolf" class="footer-social__icon footer-social__icon--twitter"> | |
<span>Twitter</span> | |
</a> |
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
.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