CHAPTER 47 · HTML

Progress and meter: describe completion or a measured amount

Choose the right indicator, label it clearly and explain its numeric range. A visual bar does not measure work or update itself.

Download example files (ZIP)

Two similar-looking bars with different meanings

A student may have finished three of eight exercises. That describes work toward completion. A tank may hold 60 litres out of a 100-litre capacity. That describes a measured amount. Progress suits task completion. Meter suits a measurement within a known range.

Do not choose only by the colour or shape your browser draws. The meaning matters to people and to tools reading the document.

Progress: value compared with max

Value says how much is complete. Max says how much work represents the whole task. For value=3 and max=8, completion is three eighths, or 37.5 percent. Zero means none of the known task is complete. Progress always has a minimum of zero; it has no min attribute.

HTML fragment — part of a document
<label for="steps">Practice steps completed</label>
<progress id="steps" value="3" max="8">3 of 8</progress>

Write valid values between zero and a positive max. If max is omitted, it defaults to 1, so 0.5 means half. Explicit totals are easier to read in our examples.

Unknown completion is different from zero

Without a value attribute, progress is indeterminate: work is in progress but the amount complete is not specified. Browsers may draw an animation, but the appearance varies. Value=0 instead means a known amount with none complete.

Removing value switches from a known amount to an unknown amount. Do not write value="" and depend on how a browser repairs it. The example only displays a fixed demonstration; it does not start an actual preparation task or background download.

Label the purpose and state the amount in text

Label for connects to a progress or meter id just as it does to a labelled input. The label names what the indicator describes. Put useful numeric wording beside it as ordinary visible text too. Text inside progress is fallback content and is not a reliable accessible name.

Someone should understand what 3 of 8 refers to without guessing from a green bar. Keep the surrounding explanation consistent with the numeric attributes. A changing real task needs code or application data to update both the indicator and its text honestly.

Meter: value between min and max

For meter, min and max identify the measured range, and value gives the current measurement. In the tank example, those numbers are litres. Min=0, max=100 and value=60 mean 60 litres in a range from 0 to 100. Without explicit bounds, the default range is 0 to 1.

Meter is not an input: dragging on it does not set a quantity. Use an appropriate input such as range or number when the reader must supply a value. It is also not the right element for a task steadily approaching completion.

Low, high and optimum explain the measurement

Low and high divide a meter's range into parts. Optimum identifies an ideal point and helps the browser interpret which part is preferred. Our fictional tank has low=25, high=75 and optimum=90, so the high region is preferred. Different tasks can prefer a low or middle region instead.

Keep min <= low <= high <= max, and place optimum within the range. These are example thresholds, not advice for a real water system. Exact boundary treatment and colours should not carry the explanation alone; the paragraph states the intended regions in words.

Native appearance is not a promise

Browsers and operating systems can draw these elements differently. Do not promise that one exact colour will always mean the same thing. The attributes provide meaning, while accompanying text tells readers the actual result. CSS customisation and real updates need separate testing.

The presence of progress does not start a file transfer, and meter does not connect to a sensor. Both can be useful static examples, provided we say that they are examples. A real service must supply real measurements or completion information.

Follow the idea

Choose the meaning first
  1. 1Task completion: progress
  2. 2Unknown amount: omit progress value
  3. 3Measured range: meter
  4. 4Label the purpose and state the amount

A static indicator does not measure work or start a download.

Complete program: step-progress.html

Save this as step-progress.html. Open it in your browser.

step-progress.html
<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>A Static Task Progress Example</title>
  </head>
  <body>
    <h1>Show completed practice steps</h1>
    <main>
      <p>This is a fixed example, not an automatically measured task.</p>
      <label for="steps">Practice steps completed</label>
      <progress id="steps" value="3" max="8">3 of 8</progress>
      <p>3 of 8 steps are complete. Five steps remain.</p>
      <label for="waiting">Preparing the next exercise (amount not known)</label>
      <progress id="waiting">Amount not known</progress>
      <p>The second indicator illustrates an unknown amount, not a real background operation.</p>
    </main>
  </body>
</html>
Browser previewDocument title: A Static Task Progress Example

This preview shows the example in a browser. Save the complete code in local files to test links between pages and downloads. Same-page section links work here.

Expected result: a labelled determinate indicator for 3 of 8 and a labelled indeterminate example. The accompanying text explains both. Neither starts real work, records learning progress or advances itself.

Complete program: practice-meter.html

Save this as practice-meter.html. Open it in your browser.

practice-meter.html
<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>A Measurement Within a Range</title>
  </head>
  <body>
    <h1>Describe a fictional water level</h1>
    <main>
      <p>This example describes a tank level, not task completion.</p>
      <label for="water">Water available in litres</label>
      <meter id="water" min="0" max="100" low="25" high="75" optimum="90" value="60">
        60 of 100 litres
      </meter>
      <p>
        The fictional tank holds 60 of 100 litres. Below 25 is low; above 75 is our preferred range
        for this exercise.
      </p>
    </main>
  </body>
</html>
Browser previewDocument title: A Measurement Within a Range

This preview shows the example in a browser. Save the complete code in local files to test links between pages and downloads. Same-page section links work here.

Expected result: a labelled meter for 60 litres in a range of 0 to 100. The paragraph describes the fictional thresholds, so the lesson does not depend on the browser choosing one particular colour.

Problem and solution

Problem: a progress bar with value=0 was used to mean the amount is unknown.

Solution: omit value for an unknown amount. Keep value=0 for a known task that has not advanced, and explain the state in visible text.

Common mistakes and useful tips

  • Do not use meter for task completion.
  • Do not add min to progress.
  • Unknown and zero are different states.
  • Do not treat either element as an input control.
  • Give indicators meaningful labels.
  • Do not claim a static bar measures a download or learning activity.

Practice questions

  1. Which element suits 3 of 8 completed exercises?
  2. What percentage is 3 of 8?
  3. How is an unknown amount represented?
  4. Which element suits a tank holding 60 of 100 litres?
  5. Does a meter collect input from a user?
  6. Save the progress program. Change value to 4, then remove value. Update the visible explanation each time. What differs?
Check your practice answers
  1. Progress.
  2. 37.5 percent.
  3. A progress element without value.
  4. Meter.
  5. No. It describes a measurement; use an input to collect a value.
  6. 4 of 8 is a known halfway state. Omitting value gives an unknown amount. The accompanying text should match each state.

Interview questions

How do progress and meter differ?

Progress describes completion of a task. Meter describes a single measurement within a known range.

Why include a label and visible numeric wording?

The label explains the purpose and the text states the amount. Readers should not have to interpret a colour or bar length alone.

What does optimum mean on meter?

It identifies an ideal point so the browser can interpret preferred measurement regions. The meaning depends on the particular task.

Do these elements update themselves from real-world work?

No. The page or application must supply and update the values; the markup alone does not measure work or sensors.

Quick revision

  • Choose by meaning, not appearance.
  • Use valid numeric ranges.
  • Distinguish unknown from zero.
  • Pair the indicator with a label and honest text.