🎉 75% of content is free forever — Unlock Premium from $10/mo →
CW
NEWSLIVESearch All Content
đŸ’ŧ Servicesâ„šī¸ Aboutâœ‰ī¸ ContactView Pricing Plansfrom $10

HTML Progress and Meter: Choosing the Right Gauge

Web FoundationsFeedbackđŸŸĸ Free Lesson

Progress, Meter, and the Difference Between Them

Two elements in HTML draw a horizontal bar, and most codebases use them interchangeably. That mistake is not cosmetic. A progress element announces that an operation is moving toward an end state; a meter element announces that a measured quantity sits somewhere on a known scale. Screen readers treat them differently, browsers style them differently, and only one of them makes sense when there is no end in sight.

The distinction is easiest to hold onto with a concrete pair. Uploading a file is progress: 0 per cent to 100 per cent, monotonic, finished when it reaches the end. Disk usage is a meter: a value between 0 and capacity that rises and falls, that is fine at 40 per cent and alarming at 90 per cent, and that never completes. Put a storage gauge in a progress element and you have told every assistive technology user that their disk is 63 per cent done, which is meaningless.

Practical consequences of choosing correctly:

  • progress without a value is indeterminate and renders as a busy animation, which is the honest display for work of unknown length
  • meter carries min, max, low, high and optimum, so the bar can be coloured by meaning rather than by percentage
  • only meter communicates thresholds to users of some screen readers, which is what makes a fuel or battery indicator understandable
  • both elements are excluded from the tab order, so neither can receive focus, and neither is a control

What progress Actually Represents

The element takes exactly three numbers that matter: the current value, the max, and the implicit default of 1 when max is omitted. Omitting value entirely switches the element into its indeterminate mode, and in that state any value you set later is ignored until the attribute comes back.

<p id="label">Compiling stylesheet 3 of 7</p>
<progress id="build" aria-labelledby="label" value="3" max="7">3 of 7</progress>

<progress id="upload" aria-label="Upload progress"></progress>

<fieldset>
  <legend>Storage used</legend>
  <meter id="disk" min="0" max="500" low="350" high="425" optimum="150"
         value="412">412 GB of 500 GB</meter>
  <span id="diskText">412 GB used, approaching quota</span>
</fieldset>

Note the fallback text between the tags. Older browsers that do not render the element still expose the text content, and that text is what a screen reader may announce if the element is not mapped to a live region. Writing 3 of 7 rather than 43 per cent is a deliberate choice: the fraction is the information the user needs to decide whether to wait.

AttributeApplies toMeaningDefault
valueprogress, meterCurrent position on the scaleNone for progress, which means indeterminate
maxprogress, meterUpper bound of the scale100 for progress, 1 for meter
minmeter onlyLower bound of the scale0
lowmeter onlyBoundary between good and concerningmax, so nothing is ever low
highmeter onlyBoundary between concerning and badmax, so nothing is ever high
optimummeter onlyThe ideal valueNeutral, so no colour preference is expressed

The threshold semantics trip people up. When value is at or below low and optimum is higher than high, the bar renders in the good colour; the browser compares the value against optimum rather than assuming bigger is better. That inversion is why a disk gauge and a signal-strength gauge with identical numbers can legitimately use different thresholds.

Anatomy of a Meter

Four attributes define where a meter puts its coloured regions, and understanding them is the difference between a gauge that reads correctly and one that lies. The min and max set the physical scale, which for a disk is 0 to capacity and for a battery might be 0 to 100. The low and high values cut that scale into three zones: below low, between low and high, and above high. Finally optimum tells the browser which end of the scale is desirable.

Consider a battery indicator where a full charge is good. Set min to 0, max to 100, low to 20, high to 80, and optimum to 100. A value of 95 falls above high, but because optimum sits at the top, the browser renders it in the optimal colour rather than the warning colour. Now consider a memory-usage gauge where low usage is the goal. Keep the same numbers but set optimum to 0, and the same 95 flips to the alarm colour. Nothing else changes; the single optimum attribute inverted the meaning.

The element also carries fallback text for engines that do not render it, and that text is what matters most in practice. A meter that shows only a coloured bar with no printed value is unreadable to anyone who cannot perceive the colour.

Driving a Bar from Real Work

An indeterminate bar should last about as long as the user's patience: under a second. Beyond that, report real progress, which means the work has to be chunked in a way that yields increments. Fetching a whole response gives you nothing to report until the body arrives; streaming it in pieces gives you a byte count on every chunk.

<progress id="dl" value="0" max="100"></progress>
<span id="dlText">Waiting to start</span>

<script>
const bar = document.getElementById('dl');
const text = document.getElementById('dlText');

async function downloadWithProgress(url) {
  const response = await fetch(url);
  const total = Number(response.headers.get('content-length')) || 0;
  const reader = response.body.getReader();
  let received = 0;

  while (true) {
    const { done, value } = await reader.read();
    if (done) break;
    received += value.length;

    if (total) {
      const pct = Math.round((received / total) * 100);
      bar.value = pct;
      text.textContent = `${pct}% ¡ ${received} of ${total} bytes`;
    } else {
      // No content-length header: report megabytes, not a fake percentage.
      bar.removeAttribute('value');
      text.textContent = `${(received / 1048576).toFixed(1)} MB downloaded`;
    }
  }

  bar.value = 100;
  text.textContent = 'Download complete';
}
</script>

The branch for a missing content-length header is the important line. A progress bar stuck at 43 per cent for eight seconds erodes trust faster than an honest indeterminate spinner, so when you cannot compute a percentage, drop back to indeterminate mode and show the bytes you do know.

💡Update at most once per frame

Setting the value property in a tight loop forces style and layout work on every iteration. Coalesce updates with requestAnimationFrame, and the bar will animate smoothly while the underlying work continues unblocked.

Styling Parts the DOM Does Not Expose

Neither element is composed of children you can style. The bar you see is a shadow-root part, exposed through vendor-prefixed pseudo-elements that differ between engines. The markup above stays identical; only the stylesheet branches.

progress {
  width: 100%;
  height: 12px;
  border: none;
  border-radius: 999px;
  overflow: hidden;
}

progress::-webkit-progress-bar {
  background: #e2e8f0;
  border-radius: 999px;
}

progress::-webkit-progress-value {
  background: linear-gradient(90deg, #2563eb, #7c3aed);
  border-radius: 999px;
  transition: width 180ms ease;
}

progress::-moz-progress-bar {
  background: linear-gradient(90deg, #2563eb, #7c3aed);
  border-radius: 999px;
}

meter {
  width: 100%;
  height: 14px;
  border: none;
  background: transparent;
}

meter::-webkit-meter-optimum-value    { background: #16a34a; }
meter::-webkit-meter-suboptimum-value { background: #f59e0b; }
meter::-webkit-meter-even-less-good-value { background: #dc2626; }

meter::-moz-meter-bar { background: #16a34a; }

@media (prefers-reduced-motion: reduce) {
  progress::-webkit-progress-value { transition: none; }
}

Firefox exposes only a single -moz-meter-bar pseudo-element, so per-threshold colouring is limited there; if the colour carries meaning, print the value as text beside the bar as well. That redundancy helps everyone, including users in high-contrast mode where gradients are often flattened.

When a Skeleton or a Spinner Is Better

Progress and meter describe states you can quantify. Most loading experiences cannot be, and forcing a number onto them produces the uncanny feeling of a bar that jumps from 5 per cent to 90 per cent and back. A skeleton screen communicates shape instead of speed: the layout will look like this, and it will be filled shortly.

The decision tree is short. If you know the total and the consumed portion, use progress with a value. If you know a bounded quantity that is not a task, use meter. If the work has an unknown duration, use an indeterminate progress element for up to about one second and then switch to a skeleton or a plain status message. If nothing is happening yet, show a button state change rather than any bar at all.

Whichever you choose, pair the visual with a text update in an element marked with role="status". Colour and motion are unreliable channels: a third of your users will not distinguish the green bar from the red one, and none of them can hear a bar move.

Support, Fallbacks and Older Engines

Both elements shipped with HTML5 and now have near-universal support, so the interesting question is not whether they render but what happens when they do not. An engine without support treats them as inline elements and displays their text content, which is why the fallback string must carry real information rather than a decorative label. Writing 73% inside the tags degrades to a bare number with no context; writing 73 of 100 tasks processed degrades to a sentence.

You can detect support at runtime by checking whether the element exposes its own interface rather than a generic HTMLUnknownElement, then substituting a styled div with an inner bar whose width you set from a CSS custom property. Keep the substitution behind the same value property the real element would have used, and your update code stays engine-agnostic.

One behavioural difference is worth testing before launch. Safari renders an indeterminate progress element as a striped animation, while Chrome renders it as a sliding gradient, and Firefox as a repeating block. If the visual identity of your product depends on that animation, style it explicitly rather than assuming the default matches your design system.

Common Mistakes

Using progress for storage, battery, or score, where the value can go down

Fix: Use meter; progress implies a task that finishes, and its value is expected to increase monotonically.

Removing the value attribute to show an animation while a percentage is actually known

Fix: Keep the value accurate; an indeterminate bar is for work whose length you genuinely cannot measure.

Colouring meter without printing the number

Fix: Always show the value as text beside the bar so the meaning survives colour blindness and high-contrast modes.

Letting a fake percentage tick up on a timer

Fix: Drive the bar from real byte counts or task counts, or leave it indeterminate until real data arrives.

Key Takeaways

  • progress reports how far a task has gone; meter reports where a measurable quantity sits on a scale.
  • Omitting the value attribute puts progress into indeterminate mode, which is the correct display for unknown durations.
  • meter's low, high and optimum thresholds let the browser colour the bar by meaning rather than by size.
  • Vendor-prefixed pseudo-elements are the only way to style these bars, so pair colour with printed text.
  • Announce changes in a role="status" region; bars themselves are silent to screen readers.
CW

ChatWhole Learn Editorial Team

Written by experienced data scientists, software engineers, and educators. All content is reviewed by industry professionals to ensure accuracy and relevance.

Last reviewed: 2026-10-12

—
☆☆☆☆☆
0 ratings

Rate & Feedback

Need Expert Web Development Help?

Get personalized tutoring, project support, or professional consulting.

Advertisement