Skip to main content

HTML Tags

HTML <progress> Tag

Written by Updated HTML <progress> Tag exercises

The progress tag shows how far a task has got: an upload at 45%, step 3 of 5, a download in progress. Leave out the value and it becomes an "in progress" animation for tasks whose length you do not know.

For a measurement that is not a task, like disk space or a score, use the meter tag instead.

Syntax

html

<progress value="current" max="total">Fallback text</progress>
AttributeWhat it does
valueHow much is done. Leave it out for an indeterminate bar.
maxThe total. Default 1, so value="0.45" also means 45%.

Example

html

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Progress Tag Example</title>
</head>
<body>
  <h2>File Upload</h2>
  <label for="fileUpload">Upload Progress:</label>
  <progress id="fileUpload" value="45" max="100">45%</progress>
  <p>Upload is at 45%.</p>
</body>
</html>

A bar appears, 45% full, with a label and the same value written in text. The text between the tags is a fallback for very old browsers; the paragraph under it is for everyone.

Updating it with JavaScript

Moving the bar as work is done

html

<progress id="upload" value="0" max="100"></progress>

<script>
  const bar = document.getElementById("upload");
  bar.value = 75;               // 75% done
  bar.removeAttribute("value"); // back to "still working"
</script>

Browser Support

Chrome
Edge
Firefox
Safari
Opera
IE9+
YesYesYesYesYesYes

Good to know

  • Always give the bar a label, with <label for> or aria-label, so screen readers know what is progressing.
  • Show the number in text too, like "45%". The bar alone is hard to read exactly.
  • The look differs between browsers. Styling it consistently needs browser-specific pseudo-elements such as ::-webkit-progress-value and ::-moz-progress-bar.

HTML <progress> Tag exercises

Show progress

Show a task that is 30 out of 100 done. Its text for browsers that cannot draw it is 30%.

Result

Check your answer to see it here.