Open In App

How to Create a Progress Bar using HTML?

Last Updated : 18 Jun, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

To create the progress bar of a task by using a <progress> tag. It is used to represent the progress of a task. It is also defined as how much work is done and how much is left. It is not used to represent the disk space or relevant query.

Syntax:

<progress attributes...> </progress>

Approach

  • The HTML document, <head> section containing a <title> tag to set the page title as “Represent the progress of a task.”
  • Inside the <body> section, a paragraph (<p>) is used to describe the first progress bar, which indicates the downloading progress for a song at 20%.
  • A <progress> element is used to visually represent the progress, with the value attribute set to “20” and the max attribute set to “100,” indicating 20% completion.
  • This pattern is repeated for two additional progress bars, with corresponding descriptions and progress values set to 50% and 100%, respectively, each using the <progress> element with appropriate value and max attributes.

Example: The example shows how to Create a Progress Bar using HTML5

html
<!DOCTYPE html>
<html>

<head>
	<title>
		Represent the progress of a task
	</title>
</head>

<body>
	<p>Downloading progress for a song with value 20:</p>
	<progress value="20" max="100">
	</progress>

	<p>Downloading progress for a song with value 50:</p>
	<progress value="50" max="100">
	</progress>

	<p>Downloading progress for a song with value 100:</p>
	<progress value="100" max="100">
	</progress>
</body>

</html>

Output:

progressbar

Output



Next Article

Similar Reads