W3C home > Mailing lists > Public > whatwg@whatwg.org > April 2008

[whatwg] rating markup (was Re: ALT and equivalent representation)

From: Edward O'Connor <hober0@gmail.com>
Date: Sat, 19 Apr 2008 14:26:38 -0700
Message-ID: <m2bq45tu29.fsf_-_@gmail.com>
> For instance it would be reasonable to use two images -- a filled star
> and an unfilled star -- to represent a rating of something:
>
>    <p>Rating: <img src=1><img src=1><img src=1><img src=0><img src=0></p>
>
> You'd want the text version to be:
>
>    Rating: 3/5

HTML5 provides the <meter> element for this use case.

    <p>Rating: <meter>3/5</meter></p>

You could then style it appropriately:

    meter[value="0"] { background-image: url(0-out-of-5.png); }
    meter[value="1"] { background-image: url(1-out-of-5.png); }
    ...
    meter[value="5"] { background-image: url(5-out-of-5.png); }


Ted
Received on Saturday, 19 April 2008 14:26:38 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:01 UTC