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 |