Created
April 12, 2013 18:42
-
-
Save kcarnold/5374176 to your computer and use it in GitHub Desktop.
Star ratings, thanks to http://dabblet.com/gist/1718992 (https://twitter.com/dmfilipenko/status/164800384953614336) for the trick: right-float radio buttons so they display in the right order. I think the dabblet's labeled order was wrong, but I used FontAwesome instead of sprites (you'll need to include its CSS), and I didn't finish porting ove…
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
<span class="rating"> | |
<input id="star-5" name="radioradio" type="radio" value="5"><label for="star-5"></label> | |
<input id="star-4" name="radioradio" type="radio" value="4"><label for="star-4"></label> | |
<input id="star-3" name="radioradio" type="radio" value="3"><label for="star-3"></label> | |
<input id="star-2" name="radioradio" type="radio" value="2"><label for="star-2"></label> | |
<input id="star-1" name="radioradio" type="radio" value="1"><label for="star-1"></label> | |
</span> | |
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
.rating { | |
font-family: FontAwesome; | |
display: inline-block; | |
} | |
.rating input { | |
display: none; | |
} | |
.rating label { | |
float: right; | |
padding-left: 2px; | |
font-size: 120%; | |
} | |
.rating label:before { | |
content: ""; | |
} | |
.rating input:checked+label:before, | |
input:checked~label:before, | |
.rating:hover label:hover:before, | |
.rating:hover label:hover~label:before { | |
content: ""; | |
color: #E3CF7A; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment