Description
The <progress>
element represents the completion progress of a task.
This element normally used to indicate how much of a task has been completed, such as loading something on a page or registration process. It is typically displayed as a progress bar and often marked as a percentage from 0 to 100%.
Text within the <progress>
element is typically rendered by the browsers in a monospace (fixed-width) font, such as Courier, but this style can be overridden using CSS.
The following table summarizes the usages context and the version history of this tag.
Placement: | Inline |
---|---|
Content: | Inline and text, but no <progress> among its descendants |
Start/ End Tag: | Start tag: required, End tag: required |
Version: | HTML 5 |
Syntax
The basic syntax of the <progress>
tag is given with:
HTML/XHTML: <progress> ... </progress>
The example below shows the <progress>
tag in action.
<h2>Task Progress</h2>
<p>Progress: <progress id="bar" value="0" max="100"><span>0</span>%</progress></p>
<script type="text/javascript">
var i = 0;
var progressBar = document.getElementById("bar");
function countNumbers(){
if(i < 100){
i = i + 1;
progressBar.value = i;
// For browsers that don't support progress tag
progressBar.getElementsByTagName("span")[0].textContent = i;
}
// Wait for sometime before running this script again
setTimeout("countNumbers()", 500);
}
countNumbers();
</script>
Note: The <progress>
element normally used in conjunction with the JavaScript to display the progress of a task. This element should not be used for representing a gauge. To represent a gauge, use the <meter>
tag instead.
Tag-Specific Attributes
The following table shows the attributes that are specific to the <progress>
tag.
Global Attributes
Like all other HTML tags, the <progress>
tag supports the glodelal Attributes in HTML5.
Event Attributes
The <progress>
tag also supports the event Attributes in HTML5.
Browser Compatibility
Element | |||||
---|---|---|---|---|---|
<progress> | Yes | Yes | Yes | Yes | Yes |
- Installation
- HTML <a> Tag
- HTML <abbr> Tag
- HTML <acronym> Tag
- HTML <address> Tag
- HTML <applet> Tag
- HTML <area> Tag
- HTML <article> Tag
- HTML <aside> Tag
- HTML <audio> Tag
- HTML <base> Tag
- HTML <b> Tag
- HTML <basefont> Tag
- HTML <bdi> Tag
- HTML <bdo> Tag
- HTML <big> Tag
- HTML <blockquote> Tag
- HTML <br> Tag
- HTML <body> Tag
- HTML <center> Tag
- HTML <button> Tag
- HTML <cite> Tag
- HTML <canvas> Tag
- HTML <caption> Tag
- HTML <code> Tag
- HTML <col> Tag
- HTML <dd> Tag
- HTML <colgroup> Tag
- HTML <dfn> Tag
- HTML <del> Tag
- HTML <div> Tag
- HTML <dl> Tag
- HTML <details> Tag
- HTML <dt> Tag
- HTML <em> Tag
- HTML <embed> Tag
- HTML <fieldset> Tag
- HTML <figure> Tag
- HTML <figcaption> Tag
- HTML <font> Tag
- HTML <footer> Tag
- HTML <datalist> Tag
- HTML <frameset> Tag
- HTML <frame> Tag
- HTML5 Global Attributes
- HTML <head> Tag
- HTML <header> Tag
- HTML <hgroup> Tag
- HTML <hr> Tag
- HTML <html> Tag
- HTML <iframe> Tag
- HTML <i> Tag
- HTML <form> Tag
- HTML <input> Tag
- HTML <keygen> Tag
- HTML <legend> Tag
- HTML <ins> Tag
- HTML <kbd> Tag
- HTML <li> Tag
- HTML <link> Tag
- HTML <map> Tag
- HTML <img> Tag
- HTML <mark> Tag
- HTML <menu> Tag
- HTML <meta> Tag
- HTML <meter> Tag
- HTML <nav> Tag
- HTML <noframes> Tag
- HTML <noscript> Tag
- HTML <object> Tag
- HTML <ol> Tag
- HTML <optgroup> Tag
- HTML <option> Tag
- HTML <output> Tag
- HTML <p> Tag
- HTML <param> Tag
- HTML <pre> Tag
- HTML <progress> Tag
- HTML <q> Tag
- HTML <rp> Tag
- HTML <rt> Tag
- HTML <ruby> Tag
- HTML <s> Tag
- HTML <samp> Tag
- HTML <script> Tag
- HTML <section> Tag
- HTML <select> Tag
- HTML <small> Tag
- HTML <source> Tag
- HTML <strike> Tag
- HTML <span> Tag
- HTML <style> Tag
- HTML <strong> Tag
- HTML <sub> Tag
- HTML <summary> Tag
- HTML <sup> Tag
- HTML <table> Tag
- HTML <tbody> Tag
- HTML <td> Tag
- HTML <textarea> Tag
- HTML <th> Tag
- HTML <tfoot> Tag
- HTML <thead> Tag
- HTML <source> Tag
- HTML <tr> Tag
- HTML <tt> Tag
- HTML <title> Tag
- HTML <u> Tag
- HTML <ul> Tag
- HTML <var> Tag
- HTML <video> Tag
- HTML <wbr> Tag
- HTML <dir> Tag