Skip to content
Tutorials Center
My learning

Topics

HTML Reference ยท Forms

The <meter> element

Reference for the HTML <meter> element: showing a value within a known range, the low, high and optimum zones, how it differs from progress, and technical details.

The <meter> element shows a scalar measurement within a known range: disk usage, a battery level, a relevance score, the strength of a password. It is a gauge, not a progress bar. Browsers draw it as a horizontal bar and can color it green, yellow or red depending on which zone the value falls in.

HTML
<label for="disk">Disk usage</label>
<meter id="disk" min="0" max="512" value="384">384 of 512 GB</meter>

The text inside is a fallback for browsers that can't draw the gauge and can repeat the value in words.

Try it

Low, high and optimum zones

Move the slider: the demo meter turns from the "suboptimal" color to the "optimal" one as the value crosses low and high. The exact colors depend on the browser.

Attributes

Attribute Values Description
value Number The current measurement. Clamped to the minโ€“max range. Defaults to 0 if missing or invalid.
min Number Lower bound of the range. Default 0.
max Number Upper bound of the range. Default 1.
low Number Upper edge of the "low" zone. Defaults to min.
high Number Lower edge of the "high" zone. Defaults to max.
optimum Number The best value. Its position (in the low zone, the high zone or between them) tells the browser which zone is good. Defaults to the midpoint.

The values must satisfy min โ‰ค low โ‰ค high โ‰ค max, and value and optimum must lie between min and max. It also accepts the global attributes.

Usage notes

  • <meter> vs <progress>. A meter is a measurement that can go up or down (fuel, temperature, score). A <progress> bar shows how far a task has advanced toward completion. Don't use a meter for loading bars.
  • Use the right range. max defaults to 1, so value="70" without max="100" shows a full bar.
  • Make the number available. Screen readers announce the value, but how they phrase it varies. Put the measurement in nearby text or inside the meter as fallback, and give the meter a <label>.
  • Not a form control. A meter is labelable but never submitted and can't be edited by the user.
  • Don't rely on color alone. The zone colors aren't meaningful to everyone; the value in words is.
  • Styling. Cross-browser styling uses vendor pseudo-elements and is limited. appearance: none plus your own markup is an option when the default look won't do.

Technical summary

Content categories Flow content, phrasing content, palpable content; labelable
Permitted content Phrasing content, but no <meter> descendants
Tag omission None; both the start and end tags are required
Permitted parents Any element that accepts phrasing content
Implicit ARIA role meter
DOM interface HTMLMeterElement
Default display inline-block

Browser support

Supported in every current browser.