Created
October 11, 2012 21:34
-
-
Save kenwoodworth/3875624 to your computer and use it in GitHub Desktop.
A mixin to dynamically generate ::before syntax for icons.
This file contains hidden or 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 before-icon($icon, $icon-hover:false) { | |
position: relative; | |
z-index: 1; | |
&:before { | |
content: ''; | |
@extend .icon-#{$icon}; | |
display: block; | |
height: icon-sprite-height($icon); | |
left: 0; | |
margin-top: -(icon-sprite-height($icon)/2); | |
position: absolute; | |
top: 50%; | |
width: icon-sprite-width($icon); | |
z-index: -1; | |
} | |
@if($icon-hover) { | |
&:hover { | |
&:before { | |
@extend .icon-#{$icon-hover}; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment