Skip to content

Instantly share code, notes, and snippets.

@huang47
Created December 15, 2013 05:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save huang47/7969259 to your computer and use it in GitHub Desktop.
Save huang47/7969259 to your computer and use it in GitHub Desktop.
A Pen by Huge.
<div id="body">
<input id="mdxRatings" type="range" class="ratings" min="1" max="5" value="1" onchange="mdxRatings.dataset.value=value;" />
</div>
body, div, input {
margin: 0;
padding: 0;
border: 0;
}
#body {
position: relative;
left: 100px;
top: 100px;
}
.ratings {
-webkit-appearance: none;
background: url(http://cdn-0.nflximg.com/us/ffe/mobileui/ratingUI_emptystar.png) 0 0 repeat;
width: 260px;
height: 50px;
}
.ratings::-webkit-slider-thumb {
-webkit-appearance: none;
position: absolute;
left: 0;
top: 0;
background: url(http://cdn-0.nflximg.com/us/ffe/mobileui/ratingUI_fullstar.png) 0 0 no-repeat;
width: 52px;
height: 50px;
}
.ratings:after {
position: absolute;
content: '';
left: 0;
background: url(http://cdn-0.nflximg.com/us/ffe/mobileui/ratingUI_fullstar.png) 0 0 repeat-x;
height: 52px;
}
.ratings[data-value="1"]:after { width: 52px; }
.ratings[data-value="2"]:after { width: 104px; }
.ratings[data-value="3"]:after { width: 156px; }
.ratings[data-value="4"]:after { width: 208px; }
.ratings[data-value="5"]:after { width: 260px; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment