I’m implementing a star-rating system on a product page. The current one is bloated and couldn’t be considered semantic.
Is there a better way to approach ratings in HTML5 now (with for e.g. the <range> input)? Or failing that, what is the appropriate way to write the markup for a star-rating system?
For voting it is semantically a form (not a set of links, because this action has side effects, so must it use POST method). Stars could be radio buttons (with
<label>!) or submit buttons (unfortunately this will be tricky to style).<input type=range>would be more appropriate if you had rating in%or some larger scale. For a typical 1-5 rating it might not be the best solution:For presenting the ratings, HTML doesn’t have any specific elements, but you could use hReview or hReview-aggregate microformats or equivalent microdata (Google likes them).