Imageless CSS Star Rating with Javascript

It was really disturbing to me that there were so many “CSS star rating” examples out there, and every single one of them was relying on images. Surely this wasn’t impossible to do with just CSS. Turns out, it is, but luckily we have Javascript.

So how do you show a star without an image? CSS’s pseudo-element :before is the man for the job.

a.star:before {content:"\2605"}

See the buttons below for more, and special thanks to +Mike Belardo for getting his Javascript on.