mozilla

Revision 459283 of <progress>

  • Revision slug: Web/HTML/Element/progress
  • Revision title: <progress>
  • Revision id: 459283
  • Created:
  • Creator: punter
  • Is current revision? No
  • Comment

Revision Content

{{ HTMLVersionHeader(5) }}

Summary

The HTML <progress> Element is used to view the completion progress of a task. While the specifics of how it's displayed is left up to the browser developer, it's typically displayed as a progress bar. Javascript can be used to manipulate the value of progress bar.

Attributes

This element includes the global attributes.

{{ htmlattrdef("max") }}
This attribute describes how much work the task indicated by the progress element requires.
{{ htmlattrdef("value") }}
This attribute specifies how much of the task that has been completed. It must be between 0 and max, or between 0 et 1.0 if max is omitted. If there is no value attribute, the progress bar is indeterminate; this indicates that an activity is ongoing with no indication of how long it is expected to take.

You can use the {{ cssxref("orient") }} property to specify whether the progress bar should be rendered horizontally (the default) or vertically. The {{ cssxref(":indeterminate") }} pseudo-class can be used to match against indeterminate progress bars.

Examples

<progress value="70" max="100">70 %</progress>

Result

{{ EmbedLiveSample("Examples", 200, 50) }}

On Mac OS X, the resulting progress looks like this:

progress-1.png

On Windows, the resulting progress looks like this:

progress-firefox.JPG

Additional examples

See {{ cssxref("orient") }}.

Specifications

Specification Status Comment
{{SpecName('HTML WHATWG', 'the-button-element.html#the-progress-element', '<progress>')}} {{Spec2('HTML WHATWG')}}  
{{SpecName('HTML5 W3C', 'forms.html#the-progress-element', '<progress>')}} {{Spec2('HTML5 W3C')}}

Browser compatibility

{{ CompatibilityTable() }}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 6.0 {{ CompatGeckoDesktop("6.0") }} [1][2] 10 11.0 5.2
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support {{ CompatNo() }} {{ CompatGeckoMobile("6.0") }} [1][2] {{ CompatNo() }} 11.0 {{ CompatNo() }}

Gecko notes

[1] Gecko provides the {{ cssxref("::-moz-progress-bar") }} pseudo-element, which lets you style the part of the interior of the progress bar representing the amount of work completed so far.

[2] Prior to Gecko 14.0 {{ geckoRelease("14.0") }}, the <progress> element was incorrectly classified as a form element, and therefore had a form attribute. This has been fixed.

See also

{{ HTML:Element_Navigation() }}

Revision Source

<div>
  {{ HTMLVersionHeader(5) }}</div>
<h2 id="Summary">Summary</h2>
<p>The <strong>HTML<em> </em><code>&lt;progress&gt;</code> Element</strong> is used to view the completion progress of a task. While the specifics of how it's displayed is left up to the browser developer, it's typically displayed as a progress bar. Javascript can be used to manipulate the value of progress bar.</p>
<ul class="htmlelt">
  <li><dfn><a href="/en-US/docs/Web/HTML/Content_categories" title="HTML/Content_categories">Content categories</a></dfn> <a href="/en-US/docs/Web/HTML/Content_categories#Flow_content" title="HTML/Content categories#Flow content">Flow content</a>, <a href="/en-US/docs/Web/HTML/Content_categories#Phrasing_content" title="HTML/Content categories#Phrasing content">phrasing content</a>, labelable content, palpable content.</li>
  <li><dfn>Permitted content</dfn> <a href="/en-US/docs/Web/HTML/Content_categories#Phrasing_content" title="HTML/Content_categories#Phrasing_content">Phrasing content</a>, but there must be no <code>&lt;progress&gt;</code> element among its descendants.</li>
  <li><dfn>Tag omission</dfn> {{no_tag_omission}}</li>
  <li><dfn>Permitted parent elements</dfn> Any element that accepts <a href="/en-US/docs/Web/HTML/Content_categories#Phrasing_content" title="HTML/Content_categories#Phrasing_content">phrasing content</a>.</li>
  <li><dfn>DOM interface</dfn> {{domxref("HTMLProgressElement")}}</li>
</ul>
<h2 id="Attributes">Attributes</h2>
<p><span style="line-height: 21px;">This element includes the&nbsp;</span><a href="/en-US/docs/Web/HTML/Global_attributes" style="line-height: 21px;" title="HTML/Global attributes">global attributes</a><span style="line-height: 21px;">.</span></p>
<dl>
  <dt>
    {{ htmlattrdef("max") }}</dt>
  <dd>
    This attribute describes how much work the task indicated by the <code>progress</code> element requires.</dd>
  <dt>
    {{ htmlattrdef("value") }}</dt>
  <dd>
    This attribute specifies how much of the task that has been completed. It must be between 0 and <code>max</code>, or between 0 et 1.0 if <code>max</code> is omitted. If there is no <code>value</code> attribute, the progress bar is indeterminate; this indicates that an activity is ongoing with no indication of how long it is expected to take.</dd>
</dl>
<p>You can use the {{ cssxref("orient") }} property to specify whether the progress bar should be rendered horizontally (the default) or vertically. The {{ cssxref(":indeterminate") }} pseudo-class can be used to match against indeterminate progress bars.</p>
<dl>
</dl>
<h2 id="Examples">Examples</h2>
<pre class="brush: html">
&lt;progress value="70" max="100"&gt;70 %&lt;/progress&gt;
</pre>
<h3 id="Result">Result</h3>
<p>{{ EmbedLiveSample("Examples", 200, 50) }}</p>
<p>On Mac OS X, the resulting progress looks like this:</p>
<p><img alt="progress-1.png" class="internal default" src="/@api/deki/files/4946/=progress-1.png" style="" /></p>
<p>On Windows, the resulting progress looks like this:</p>
<p><img alt="progress-firefox.JPG" class="internal default" src="/@api/deki/files/6031/=progress-firefox.JPG" /></p>
<h3 id="Additional_examples">Additional examples</h3>
<p>See {{ cssxref("orient") }}.</p>
<h2 id="Specifications" name="Specifications">Specifications</h2>
<table class="standard-table">
  <thead>
    <tr>
      <th scope="col">Specification</th>
      <th scope="col">Status</th>
      <th scope="col">Comment</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>{{SpecName('HTML WHATWG', 'the-button-element.html#the-progress-element', '&lt;progress&gt;')}}</td>
      <td>{{Spec2('HTML WHATWG')}}</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>{{SpecName('HTML5 W3C', 'forms.html#the-progress-element', '&lt;progress&gt;')}}</td>
      <td>{{Spec2('HTML5 W3C')}}</td>
    </tr>
  </tbody>
</table>
<h2 id="Browser_compatibility">Browser compatibility</h2>
<p>{{ CompatibilityTable() }}</p>
<div id="compat-desktop">
  <table class="compat-table">
    <tbody>
      <tr>
        <th>Feature</th>
        <th>Chrome</th>
        <th>Firefox (Gecko)</th>
        <th>Internet Explorer</th>
        <th>Opera</th>
        <th>Safari</th>
      </tr>
      <tr>
        <td>Basic support</td>
        <td>6.0</td>
        <td>{{ CompatGeckoDesktop("6.0") }} [1][2]</td>
        <td>10</td>
        <td>11.0</td>
        <td>5.2</td>
      </tr>
    </tbody>
  </table>
</div>
<div id="compat-mobile">
  <table class="compat-table">
    <tbody>
      <tr>
        <th>Feature</th>
        <th>Android</th>
        <th>Firefox Mobile (Gecko)</th>
        <th>IE Mobile</th>
        <th>Opera Mobile</th>
        <th>Safari Mobile</th>
      </tr>
      <tr>
        <td>Basic support</td>
        <td>{{ CompatNo() }}</td>
        <td>{{ CompatGeckoMobile("6.0") }} [1][2]</td>
        <td>{{ CompatNo() }}</td>
        <td>11.0</td>
        <td>{{ CompatNo() }}</td>
      </tr>
    </tbody>
  </table>
</div>
<h3 id="Gecko_notes">Gecko notes</h3>
<p>[1] Gecko provides the {{ cssxref("::-moz-progress-bar") }} pseudo-element, which lets you style the part of the interior of the progress bar representing the amount of work completed so far.</p>
<p>[2] Prior to Gecko 14.0 {{ geckoRelease("14.0") }}, the <code>&lt;progress&gt;</code> element was incorrectly classified as a form element, and therefore had a <code>form</code> attribute. This has been fixed.</p>
<h2 id="See_also">See also</h2>
<ul>
  <li>{{ cssxref("orient") }}</li>
  <li>{{ cssxref(":indeterminate") }}</li>
  <li><a href="http://www.tutorialspark.com/HTML5_Tags_Reference/HTML5_progress_Tag.php" title="http://www.tutorialspark.com/HTML5_Tags_Reference/HTML5_progress_Tag.php">HTML5 Progress Element</a></li>
</ul>
<p>{{ HTML:Element_Navigation() }}</p>
Revert to this revision