Movatterモバイル変換


[0]ホーム

URL:


MDN Web Docs

<meter>: The HTML Meter element

BaselineWidely available

The<meter>HTML element represents either a scalar value within a known range or a fractional value.

Try it

<label for="fuel">Fuel level:</label><meter min="0" max="100" low="33" high="66" optimum="80" value="50">  at 50/100</meter>
label {  padding-right: 10px;  font-size: 1rem;}

Attributes

This element includes theglobal attributes.

value

The current numeric value. This must be between the minimum and maximum values (min attribute andmax attribute) if they are specified. If unspecified or malformed, the value is0. If specified, but not within the range given by themin attribute andmax attribute, the value is equal to the nearest end of the range.

Note:Unless thevalue attribute is between0 and1 (inclusive), themin andmax attributes should define the range so that thevalue attribute's value is within it.

min

The lower numeric bound of the measured range. This must be less than the maximum value (max attribute), if specified. If unspecified, the minimum value is0.

max

The upper numeric bound of the measured range. This must be greater than the minimum value (min attribute), if specified. If unspecified, the maximum value is1.

low

The upper numeric bound of the low end of the measured range. This must be greater than the minimum value (min attribute), and it also must be less than the high value and maximum value (high attribute andmax attribute, respectively), if any are specified. If unspecified, or if less than the minimum value, thelow value is equal to the minimum value.

high

The lower numeric bound of the high end of the measured range. This must be less than the maximum value (max attribute), and it also must be greater than the low value and minimum value (low attribute andmin attribute, respectively), if any are specified. If unspecified, or if greater than the maximum value, thehigh value is equal to the maximum value.

optimum

This attribute indicates the optimal numeric value. It must be within the range (as defined by themin attribute andmax attribute). When used with thelow attribute andhigh attribute, it gives an indication where along the range is considered preferable. For example, if it is between themin attribute and thelow attribute, then the lower range is considered preferred. The browser may color the meter's bar differently depending on whether the value is less than or equal to the optimum value.

Examples

Basic Example

HTML

html
<p>Battery level: <meter min="0" max="100" value="75">75%</meter></p>

Result

High and low range example

Note that in this example themin attribute is omitted. This is allowed, as it will default to0.

HTML

html
<p>  Student's exam score:  <meter min="0" low="50" high="80" max="100" value="84">84%</meter></p>

Result

Technical Summary

Content categoriesFlow content,phrasing content, labelable content, palpable content.
Permitted contentPhrasing content, but there must be no<meter> element among its descendants.
Tag omissionNone, both the starting and ending tag are mandatory.
Permitted parents Any element that acceptsphrasing content.
Implicit ARIA rolemeter
Permitted ARIA rolesNorole permitted
DOM interfaceHTMLMeterElement

Specifications

Specification
HTML
# the-meter-element

Browser compatibility

See also

Help improve MDN

Learn how to contribute.

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp