The <meter> tag in HTML5
, by
Aurélien Aries
Example
It is
a measurement between known minimum and maximum values. You can use it to illustrate a hard drive space or a vote result.
We could write this :
It is not
- a progress bar. There’s a special tag for that : <progress>
- to report a value if you don’t know the range.
So we can’t write this :
Recommendations
- The
value
attribute has to be specified. - The content of the tag can’t be empty
- The best way of giving a value is to include it as contents of the element :
Attributes
- value = the “measured” value. Must be specified.
- min = the minimum value of the range
- max = the maximum value of the range
- low = the range considered as the “low” part
- high = the range considered as the “hight” part
- optimum = the best range
- form = the ID of a form element. It is, by default, associated with its ancestor form element.
low, high and optimum
if value is lower than low, the gauge is orange :
if value is higher than high, the gauge is orange :
Basically the gauge becomes green when value is close to optimum so :
When value is lower than low, if optimum is lower than low, the gauge is green :
When value is higher than high, if optimum is higher than high, the gauge is green :
When optimum is between low and high, the gauge is green when close to optimum :
Browser Support
Supported | Partially supported | Not supported |
---|---|---|
Chrome 8 | IE 10 | IE 9 |
Safari 5.2 | Firefox 6 | Safari 5.1 |
Opera 11 | Firefox for Android 14 | IOS Safari 5.0 |
Opera Mobile 11 | Android 4.0 | |
Chrome for Android 18 | Opera Mini 6.0 |