HTML <meter>元素用来显示已知范围的标量值或者分数值。
Content categories | Flow content, phrasing content, labelable content, palpable content. |
---|---|
Permitted content | Phrasing content, but there must be no <meter> element among its descendants. |
Tag omission | {{no_tag_omission}} |
Permitted parents | Any element that accepts phrasing content. |
Permitted ARIA roles | None |
DOM interface | {{domxref("HTMLMeterElement")}} |
该元素包含所有的全局属性.
<p>Heat the oven to <meter min="200" max="500" value="350">350 degrees</meter>.</p>
{{EmbedLiveSample("Simple_example", 300, 60)}}
在Google Chrome浏览器上, 计量器结果如下:
注意本例中min属性被省略,这是允许的,默认值为0。
<p>He got a <meter low="69" high="80" max="100" value="84">B</meter> on the exam.</p>
{{EmbedLiveSample("High_and_Low_range_example", 300, 60)}}
Google Chrome浏览器中,计量器显示效果如下:
Specification | Status | Comment |
---|---|---|
{{SpecName('HTML WHATWG', 'forms.html#the-meter-element', '<meter>')}} | {{Spec2('HTML WHATWG')}} | |
{{SpecName('HTML5 W3C', 'forms.html#the-meter-element', '<meter>')}} | {{Spec2('HTML5 W3C')}} | Initial definition |
{{CompatibilityTable}}
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Edge | Opera | Safari |
---|---|---|---|---|---|---|---|
Basic support | 6.0 | {{CompatVersionUnknown}} | {{CompatGeckoDesktop("16.0")}} | {{CompatNo}} | 20[1] | 11.0 | 5.2 |
Feature | Android | Edge | Firefox Mobile (Gecko) | IE Mobile | Edge Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|---|
Basic support | {{CompatNo}} | {{CompatVersionUnknown}} | {{CompatGeckoMobile("16.0")}} | {{CompatNo}} | 20[1] | 11.0 | {{CompatNo}} |
[1] See the Microsoft Edge Platform Status page.