Meter (<meter>)

When to use 

A meter serves as a graphical depiction that showcases a numeric value, which remains within a defined range. 3

Rules

  • A <meter> elment should only be used if there is a known lower and upper limit. 1
  • Meters should not be used to indicate progress (for example loading). Use the <progress> elmement instead. 1
  • You should provide an accessible name. The most reliable method is explicitly using the <label for="<id>"> element and associating it via the "for" attribute. 2 Otherwise use aria-labelledby or aria-label.
  • Include a textual representation of the current value of the meter inside the <meter> element, in case that the user agent does not support the meter element. 1 This textual representation is not used for the computation of the accessible name.
  • The unit of the <meter> element can be defined as a free-form text inside the title attribute. 1

Examples

  • disk usage 1
  • query result relevance from 0 to 100 1
  • percentage of a population voting for a candidate 1
<label for="cpuMeterLow"> CPU Usage:</label> <meter id="cpuMeterLow" min="0" max="100" high="80" value="30">30%</meter>
<label for="cpuMeterHigh"> CPU Usage:</label> <meter id="cpuMeterHigh" min="0" max="100" high="80" value="85">85%</meter>

30%

85%

Sources 

  1. HTML Spec: 4.10.14 The meter element is licensed under Creative Commons Attribution 4.0 International License
  2. HTML Spec: 4.10.2 Categories is licensed under Creative Commons Attribution 4.0 International License
  3. MDN: <meter>: The HTML Meter element by Mozilla contributors is licensed under CC-BY-SA 2.5
Created at: 09.06.2023, Last updated at: 11.06.2023