How to use the progress bar in HTML

problem

You will like to use a progress bar on your web page. For example to show the progress of a process. Instead of showing a percentage, you visually convey the status using a progress bar.

SOLUTION

In HTML we have the <progress> tag. It has an opening and closing tag. For example:

progress_bar.html
				
					<progress></progress>
				
			
output
indefinite progress bar example in HTML
specifying progress value

In order to show the progress we can use the value attribute and max attribute. For example we can set the max value to 100 and the value to 50. In this case to show 50% of something, e.g. uploading a file.

progress_bar.html
				
					<progress value="50" max="100"></progress>
				
			
output
progress bar example 50% in HTML

It shows 50% (half of it full).

We can use the progress along a label for better describing what it does to the user. For example, let’s suppose it’s uploading a file.

progress_bar.html
				
					<label for="prgbar">Uploading...</label>
<progress value="50" max="100" id="prgbar"></progress>

				
			
output
progress bar with label example in HTML

conclusion

In this post we saw how to use the <progress> tag and how to set a value.

References:

[1] https://developer.mozilla.org/en-US/docs/Web/HTML/Element/progress

Share it!

Facebook
Twitter
LinkedIn
Reddit
Picture of Ellion

Ellion

Professional IT consultant, writer, programmer enthusiast interested in all sorts of coding.
Eats all cookies 🍪

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
0
Would love your thoughts, please comment.x
()
x