I am faced with the following HTML structure:
<div class="rating">
<div class="star active"></div>
<div class="star active"></div>
<div class="star active"></div>
<div class="star"></div>
<div class="star"></div>
</div>
The generated output is as follows:
★★★☆☆
My query is regarding how to animate the active stars individually using CSS?
I attempted this method:
.star {
transition: background-color 0.5s ease;
background-color: #eee;
}
.star.active {
background-color: #000;
}
However, this approach causes all the active stars to change color simultaneously. How can I achieve a sequential transition for the active stars, moving from left to right?
I am seeking a solution that does not involve JavaScript. It should be noted that the rating system could have any number of stars, ranging from 3 to potentially an unlimited amount.