Here are two options:
When the user clicks, set the class in the parent container == to get a star rating, for example rated-3 . Then use CSS ' first-child and selector clips to activate the first star and N more stores.
When the user clicks, use JS to set class="active" on all stars before and including by clicking the star.
In both scenarios, replicate your CSS hover to apply to .active or :first-child, :first-child+s,... .active :first-child, :first-child+s,... elements.
source share