Skip to content

Instantly share code, notes, and snippets.

@shaneog
Forked from hshoff/stars.scss
Created July 4, 2014 23:42
Show Gist options
  • Save shaneog/d1c5acde6fc99eae3b3b to your computer and use it in GitHub Desktop.
Save shaneog/d1c5acde6fc99eae3b3b to your computer and use it in GitHub Desktop.
// stars.scss
// compiles to stars.css
$starWidth: 44px;
$starOffset: 0 -43px;
$numStars: 5;
$steps: 2;
$total: $numStars * $steps;
@mixin filled($n: 0) {
width: ($starWidth / $steps) * $n;
}
.stars {
background: url(/images/sprite.png) repeat-x top left;
height: 43px;
&.empty {
background-position: $starOffset;
width: $numStars * $starWidth;
}
@for $i from 0 through ($total) {
&.filled_#{$i} { @include filled($i) }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment