I followed this tutorial http://code.stephenmorley.org/html-and-css/star-rating-widget/ to build a star rating HTML/CSS component.
Now I want to modify it that the stars can't change when someone hovers over it. So I thought I add a class disabled to every label and then I adapt the CSS like this:
.starRating:not(old) > label:not(.disabled):hover:before,
.starRating:not(old) > label:not(.disabled):hover ~ label:not(.disabled):before,
.starRating:not(:hover) > :checked ~ label:before{
opacity : 1;
}
But still when my mouse comes over the stars it keeps doing the changes.
HTML:
<span class="starRating">
<input id="rating5" type="radio" name="rating" value="5" disabled checked>
<label class="disabled" for="rating5">5</label>
<input id="rating4" type="radio" name="rating" value="4" disabled>
<label class="disabled" for="rating4">4</label>
<input id="rating3" type="radio" name="rating" value="3">
<label class="disabled" for="rating3">3</label>
<input id="rating2" type="radio" name="rating" value="2">
<label class="disabled" for="rating2">2</label>
<input id="rating1" type="radio" name="rating" value="1">
<label class="disabled" for="rating1">1</label>
</span>