I'm in the process of creating a Star Rating component for our website using Angular 11. I've managed to render the 5 stars based on the current rating value, but I'm having trouble getting the hover styling just right.
Basically, if I have a rating of 2 out of 5 stars and I hover over the 4th star, the 3rd star should be filled as well. I can't seem to figure out the correct CSS for this specific effect.
.rating-icon-empty { fill: #9e9e9e }
.rating-icon { fill: #7C4DFF; margin-right: 5px; }
.editable .rating-icon-empty:hover { fill: #7C4DFF; cursor: pointer;}
My current CSS only fills the star that is being hovered over, without filling the previous empty stars. Is there a way to achieve this using pure CSS, or do I need to use hover listeners for each individual star?