JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<div class="rating">
<input type="radio" id="star5" name="rating" value="5"><label for="star5" title="Great">5 stars</label>
<input type="radio" id="star4" name="rating" value="4"><label for="star4" title="Good">4 stars</label>
<input type="radio" id="star3" name="rating" value="3"><label for="star3" title="Okay">3 stars</label>
<input type="radio" id="star2" name="rating" value="2"><label for="star2" title="Bad">2 stars</label>
<input type="radio" id="star1" name="rating" value="1"><label for="star1" title="Very Bad">1 star</label>
</div>
CSS
.rating {
display: inline-block;
}
.rating:not(:checked) > input {
display:none;
}
.rating:not(:checked) > label {
float: right;
width: 28px;
padding: 0 4px;
overflow: hidden;
white-space: nowrap;
cursor: pointer;
font-size: 200%;
line-height: 1.2;
color: #ddd;
filter: saturate(0);
-webkit-filter: saturate(0);
-moz-filter: saturate(0);
-o-filter: saturate(0);
}
.rating:not(:checked) > label:before {
content: url("http://i.imgur.com/1dT6Fai.png") ' ';
}
.rating > input:checked ~ label {
filter: saturate(1);
-webkit-filter: saturate(1);
-moz-filter: saturate(1);
-o-filter: saturate(1);
}
.rating:not(:checked) > label:hover,
.rating:not(:checked) > label:hover ~ label {
filter: hue-rotate(-50deg);
-webkit-filter: hue-rotate(-50deg);
-moz-filter: hue-rotate(-50deg);
-o-filter:hue-rotate(-50deg);
}
.rating > input:checked + label:hover,
.rating > input:checked + label:hover ~ label,
.rating > input:checked ~ label:hover,
.rating > input:checked ~ label:hover ~ label,
.rating > label:hover ~ input:checked ~ label {
filter: hue-rotate(-50deg);
-webkit-filter: hue-rotate(-50deg);
-moz-filter: hue-rotate(-50deg);
-o-filter:hue-rotate(-50deg);
}