Format Code Now
/

HTML Meter Generator

WM-35

Type a label and a value, add the range and thresholds, and copy a labelled meter element. The numbers are checked against each other before anything is written.

Runs in your browser. Nothing is uploaded.

Key: value lines (label: and value: are required; also min:, max:, low:, high:, optimum:; any other text is the fallback)

HTML

How to use it

  1. Write label: and value:, then min:, max:, low:, high: and optimum: as needed.
  2. Optionally add text on its own line for the fallback content.
  3. Copy the label and meter.
  4. Style it with CSS if the default look does not suit.

How low, high and optimum change the color

The meter element shows a value within a known range. Left alone, min is 0 and max is 1. low and high split the range into three bands, and optimum says which band is best. A value in the optimum band is shown in a good color, the next in a fair color, and the far band as bad, with the exact colors chosen by the browser. If you give no thresholds, the whole range counts as one band.

Meter or progress

Use meter for a measurement within a range, like disk space used, a score or a temperature. Use progress for a task that moves toward completion, like an upload. The text between the tags is shown by browsers that do not draw a meter, and the tool writes the value there unless you supply your own. A label linked with for and id gives assistive technology a name for the gauge.

Error messages and what to do

MessageWhat it meansFix
Add a "value:" line with the current number.The meter needs a value:.Add value: and a number.
"value:" must be between min and max.The value is outside the range.Change the value or the min and max lines.

Questions people ask

How do I make a gauge in HTML?

Use the meter element with a value, a min and a max, and a label. Add low, high and optimum if you want the browser to color the bar by how good the value is.

What is the difference between meter and progress?

progress shows how far a task has got toward done. meter shows a measurement inside a known range. A battery level is a meter; a file upload is a progress bar.

What are the default min and max of a meter?

min is 0 and max is 1 when you leave them out, so a value of 0.6 shows as 60 percent. When you use a different scale, set both explicitly.

Why does my meter show a different color?

The browser chooses it from where the value falls against low, high and optimum. It is not set by this tool. You can override the look with CSS pseudo-elements, which vary by browser.

Can a meter have a label?

Yes. meter is a labelable element, so a label with a matching for and id works, and it is written automatically here. Screen readers then announce the name with the value.

About this tool

Writes a label and a meter linked by for and id. Text that is not a key: value line becomes the content between the tags, which old browsers show instead of the gauge; with none, it writes the value (and the max, when you gave one). The numbers are checked: min below max, value inside the range, low no larger than high, and low, high and optimum inside the range. The HTML default range is 0 to 1 when you leave min and max out. The browser, not this tool, colors the gauge as good, fair or bad from low, high and optimum. meter is for a known range such as disk use, not for progress of a task; use progress for that. Optional lines: id:, class:, title:, lang:, data-* and aria-*.

Format Code Now: free, no ads, no accounts. Your input stays in your browser.