Display rating with e.g. 3.2, 4.8 ect. stars selected
Posted on 2013-05-11
I got a page with ratings and a rating can be from one to five stars. I calculate the average rating and it could be 2.4, 4.7, 1.8 etc. Right now I just round to the nearest whole number of stars and display one of my five star images.
Instead i would like to be able to display all the ratings in between as well så i guess it's a question about styling but i'm not quite sure how to accomplish it the best way.
I want the star background to fade as well so one star is red, three stars are yellow and five stars are green and it should be possible to display the exact color grading inbetween yellow and green if 3.8 was the average rating i needed to display.
How can i accomplish that and which technique should I use? I need a concrete practical example of doing it.