Created
August 11, 2016 16:02
-
-
Save seb-thomas/26a02619d581d64e1aadd7935b0af08e 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
// Assumes a vertical sprite sheet | |
$icon-size: 18px; | |
.icon { | |
display: inline-block; | |
background-repeat: no-repeat; | |
background-image: url(../images/sprite.png); | |
width: $icon-size; | |
height: $icon-size; | |
background-size: $icon-size; | |
vertical-align: middle; | |
} | |
$icons: alert angle-right arrow-down arrow-left arrow-right arrow-up close cog columns document filter flag grid new-tab restricted search tick trash zoom-in ; | |
@mixin icon-sprite($offset) { | |
$offset: $offset - 1; | |
background-position: left $icon-size*-$offset; | |
} | |
@for $i from 1 through length($icons) { | |
$icon: nth($icons, $i); | |
.icon-#{$icon} { | |
@include icon-sprite($i); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment