Cheap VPS & Xen Server


Residential Proxy Network - Hourly & Monthly Packages

HTML Progress


HTML <progress> tag is used to display the progress of a task. It provides an easy way for web developers to create progress bar on the website. It is mostly used to show the progress of a file uploading on the web page.

The HTML progress tag is new in HTML5 so you must use new browsers.


Attributes of HTML Progress Tag

HTML <progress> tag supports the global and event attributes as well as 2 specific attributes.

Tag Description
value It defines that how much work the task has been completed.
max It defines that how much work the task requires in total.

The progress tag should be used to represent progress of a task only, not for just a gauge (disk pace usage). For such purpose, <meter> element is used.


HTML Progress Tag Example

Let’s see HTML progress example without attribute.

  1. <progress></progress>

Test it Now

Output:


Let’s see the progress example with value and max attributes.

  1. Downloading progress:
  2. <progress value=“43” max=“100”></progress>

Test it Now

Output:

Downloading progress:


Styling Progress Bar

You can apply CSS code on progress tag.

  1. progress{
  2.   width: 300px;
  3.   height: 30px;
  4. }

Test it Now

Output:


HTML Progress Tag with JavaScript

The <progress> tag should be used in conjunction with JavaScript to display the progress of a task.

  1. <script>
  2. var gvalue=1;
  3. function abc(){
  4.  var progressExample = document.getElementById (‘progress-javascript-example’);
  5.      setInterval (function ()
  6.     {
  7.                  if(gvalue<100){
  8.                     gvalue++;
  9.                     progressExample.value =gvalue;
  10.                   }
  11.                  abc();
  12.       }, 1000);
  13. }
  14. </script>
  15. <progress id=“progress-javascript-example” min=“1” max=“100”></progress>
  16. <br/><br/>
  17. <button onclick=“abc()”>click me</button>

Test it Now

Output:

 


Supporting Browsers

Element chrome_browser Chrome ie_browser IE firefox_browser Firefox opera_browser Opera safari_browser Safari
<progress> Yes Yes Yes Yes Yes

Comments

comments