Last active
August 29, 2015 14:16
-
-
Save AdmireNL/8703871b8485b8da18a2 to your computer and use it in GitHub Desktop.
For loop sprite coordinates (star rating)
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
<div class="rating rating-0"></div> | |
<div class="rating rating-1"></div> | |
<div class="rating rating-2"></div> | |
<div class="rating rating-3"></div> | |
<div class="rating rating-4"></div> | |
<div class="rating rating-5"></div> |
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
// ---- | |
// Sass (v3.4.12) | |
// Compass (v1.0.3) | |
// ---- | |
// For loop sprite coordinates | |
$star-width: 50px; | |
.rating { | |
width: 240px; | |
height: 38px; | |
margin-bottom: 50px; | |
background: url("http://imgh.us/stars.svg") no-repeat; | |
background-position: 0 0; | |
@for $i from 0 through 5 { | |
&.rating-#{$i} { | |
background-position: -((5-$i) * $star-width) 0; | |
} | |
} | |
} |
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
.rating { | |
width: 240px; | |
height: 38px; | |
margin-bottom: 50px; | |
background: url("http://imgh.us/stars.svg") no-repeat; | |
background-position: 0 0; | |
} | |
.rating.rating-0 { | |
background-position: -250px 0; | |
} | |
.rating.rating-1 { | |
background-position: -200px 0; | |
} | |
.rating.rating-2 { | |
background-position: -150px 0; | |
} | |
.rating.rating-3 { | |
background-position: -100px 0; | |
} | |
.rating.rating-4 { | |
background-position: -50px 0; | |
} | |
.rating.rating-5 { | |
background-position: 0px 0; | |
} |
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
<div class="rating rating-0"></div> | |
<div class="rating rating-1"></div> | |
<div class="rating rating-2"></div> | |
<div class="rating rating-3"></div> | |
<div class="rating rating-4"></div> | |
<div class="rating rating-5"></div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment