Represent a measurement within a known range. Learn to define its bounds, interpret low, high, and optimum, and accompany the gauge with a label and an understandable value.
1.
Mental model
Position shows how much; thresholds help interpret that value.
1Range
min and max define the known scale.
2Reading
value places the measurement on that scale.
3Interpretation
low, high, and optimum identify the preferable region.
The bar does not track a taskStatic diagram: define the scale, place the reading, then explain its meaning. The following examples render real meter elements.
meter presents data; it does not let you edit it. It suits used capacity, remaining battery, or a score with a defined maximum. The reading can rise or fall without representing completed work. A number without a meaningful maximum needs text or another visualization, rather than an invented range.
2.
Range and value
The scale does not always start at zero or represent a percentage.
min defaults to 0 and max to 1. Use value="0.62" for a 62% fraction, or declare max="100" when your data uses a 0–100 scale. value must lie between min and max; numeric attributes use a decimal point and contain neither units nor a % sign. For a useful scale, set max greater than min.
A fraction with the default bounds
62%
62% used: a fraction of 0.62 on a scale from 0 to 1.
value=0.62 occupies 62% of the 0–1 range. Visible text preserves the percentage independently of the bar.
A scale starting below zero
18 °C
18 °C on a scale from −20 to 40 °C.
18 °C is approximately 63.3% of the way from −20 to 40 °C. It is not 18/40: position is calculated from the minimum.
Relative position is (value − min) / (max − min). HTML accepts negative and fractional numbers; this playground limits its controls to nonnegative integers by design. If value is missing or invalid, the browser starts at 0 and clamps it to the range; it also clamps out-of-range readings to the bounds. That correction does not validate your data: check the source and show a textual state when no reliable measurement is available.
3.
low, high, and optimum
A high number is not always good news.
low and high separate three regions, maintaining min ≤ low ≤ high ≤ max. They do not change the full scale or implicitly represent percentages. optimum identifies the preferable region: below low favors low readings; above high favors high readings; between them, including the boundaries, favors the middle region.
One reading, three interpretations
20/100
20 out of 100: the preferable low region.
20/100
20 out of 100: the low region, outside the preferable middle region.
20/100
20 out of 100: the low region, furthest from the preferable high region.
All three gauges have value=20, low=25, and high=75: their position is identical. Setting optimum to 10, 50, or 90 changes the interpretation, also written below each bar. Actual colors depend on the browser.
When omitted, low defaults to min, high to max, and optimum to the range midpoint. optimum must lie between min and max; it is neither a progress target nor a form validation constraint. When it sits in an outer region, the middle is less favorable and the opposite end is the least favorable. When it sits in the middle, both ends are less favorable. Define these criteria for your data domain and avoid treating “green” as a universal guarantee.
4.
Label and text alternative
Name the measurement and show its value, units, and interpretation.
Associate label for with the meter id to name what is being measured. Native attributes provide the range and value: there is no need to duplicate them with role="meter" or aria-valuenow/min/max. When an announced percentage would not express the data well, aria-valuetext supplies units; aria-describedby connects further explanation. Check the result with your target assistive technologies.
Used capacity with a written warning
85 GB / 100 GB
85 out of 100 GB used. High usage: review the available space.
The label identifies storage. The reading uses GB, and a visible sentence states high usage and a possible action. The information remains available if colors change or the bar is not rendered.
Content between the tags is fallback text, normally hidden when the gauge renders. It replaces neither label nor an always-visible textual reading. Put the information everyone needs outside meter and associate it when it adds context. Do not rely solely on color, a title tooltip, or a CSS pseudo-element to explain the state.
meter is a readout, not a keyboard-adjustable control. It needs no tabindex, arrow listeners, or simulated buttons. To let someone choose a value, use a labeled range or number input. If an application updates the measurement, keep its text synchronized; reserve status announcements for relevant changes instead of announcing every fluctuation.
5.
Measurement versus progress
The meaning of the data determines the element, even when the bars look similar.
meter: “what is the current level?” For example, 85 GB used out of a 100 GB capacity. There is no task that should reach 100%, and low/high/optimum can help interpret the level.
progress: “how much work is complete?” For example, 85 out of 100 files uploaded. When a task is active but the amount completed is unknown, progress without value represents an indeterminate state. Removing value from meter does not create that state.
For a quantity without useful bounds, show text with units or another suitable chart. To edit data, use an input. A bar appearance does not make these meanings interchangeable; semantics should match the person’s question.
6.
Common pitfalls
Check the scale and meaning before customizing appearance.
The bar looks full with value=62
Expected result
Show a 62% reading.
Cause
max is omitted, so the range ends at 1; the browser clamps 62 to the maximum.
Solution
Use value=0.62 or declare min=0 and max=100. Keep units and the percentage in text.
A high level incorrectly appears favorable
Expected result
Explain that high usage is less favorable.
Cause
optimum is placed at the high end although the data represents used capacity.
Solution
Define the preferable region for the data; for lower usage, place optimum below low. Also write the state in text.
Only a colored bar is visible
Expected result
Understand the measurement, number, and meaning without distinguishing colors.
Cause
Information is left inside meter or in title, with no associated label.
Solution
Add label and visible text with units; connect the explanation with aria-describedby and use aria-valuetext when helpful.
A loading task is presented as a measurement
Expected result
Communicate completed work or activity without a known percentage.
Cause
meter is chosen for its appearance and value is removed to try to simulate indeterminate activity.
Solution
Use progress for tasks. On meter, a missing value produces a default value clamped to the range.
7.
Support and compatibility
Element support does not guarantee identical appearance or assistive output.
meter is Baseline Widely Available in major browsers. This does not include every WebView: BCD still records the element as unsupported in Android WebView at the stated consultation date. Rendering, colors, and announced details can vary by browser, system, and assistive technology; test your actual targets.
These examples preserve native appearance and need no JavaScript, polyfills, or browser-specific pseudo-elements. Visible text offers an alternative reading and internal content provides basic fallback text. Customizing the bar with prefixed selectors is another compatibility layer and should not remove semantics or hide the value in forced colors.