HTML <progress> tagS2C Home   « HTML <progress> tag

Definition

The <progress> tag is used to define a progress bar representing task progress, from commencement through to completion.

Use the <progress> HTML tag with the value attribute to show actual progress or leave the value attribute out to show unpredictive progress.

Use the <label> HTML tag to give the progress bar a description and to aid accessibility.

The <progress> tag was introduced in HTML5.

Examples


<p>Predictive progress bar</p>
<label for="quiz">HTML quiz: </label>
<progress id="quiz" value="50" max="100">50</progress>
<p>Unpredictive progress bar</p>
<label for="movie">Movie download: </label>
<progress id="movie" max="100">5</progress>

Predictive progress bar

50

Unpredictive progress bar

5

Attributes

The following attributes can be used with the <progress> tag.


<progress> Specific Attributes
Attribute Value Description Example
maxnumberSpecifies a maximum value for the upper boundary of the range.

Value must be numeric - default value is 1.

<progress id="volume" max="100"></progress>
valuenumberSpecifies the current value of the range.

Value must be numeric.

<progress id="volume" value="85"></progress>
<progress> Global Attributes
Attribute Description Example
Common
classSpecifies a classname for the element allowing you to apply the style of the predefined class to the content.

<progress class="name">Progress info</progress>
idSpecifies a unique id for the element allowing you to apply the style of the predefined id to the content.

<progress id="name">Progress info</progress>
styleSpecifies an inline style for the element allowing you to apply the style to the contentt.

<progress style="color:red;">Progress info</progress>
titleSpecifies an inline style for the element allowing you to apply the style to the content.

<progress title="Content info">Progress info</progress>
Keyboard
accesskeySpecifies a keyboard shortcut to associate with the element.

<progress accesskey="a">Progress info</progress>
tabindexSpecifies a tab order for the element.

<progress tabindex="1">Progress info</progress>
Language
dirSpecifies the directional flow of the content.

<!-- The text will flow from left to right -->
<progress dir="ltr">Progress info</progress>
<!-- The text will flow from right to left -->
<progress dir="rtl">Progress info</progress>
langSpecifies a language code for the content of the element.

<progress lang="en">Progress info</progress>
spellcheckSpecifies an inline style for the element allowing you to apply the style to the contentt.

<!-- Valid values true and false. -->
<!-- Default inherited / browser specific. -->
<progress spellcheck="true">Progress info</progress> 
translateSpecifies an inline style for the element allowing you to apply the style to the content.

<!-- Valid values yes and no. -->
<!-- Default yes. -->
<progress translate="no">Progress info</progress> 
Miscellaneous
contenteditableSpecifies whether the content of the element is editable.

<!-- Valid values true and false. -->
<!-- Default inherited. -->
<progress contenteditable="true">Progress info</progress> 
draggableSpecifies whether the element is draggable.

<!-- Valid values true and false. -->
<!-- Default browser specific. -->
<progress draggable="true">Progress info</progress>
hiddenSpecifies whether the element is not yet, or no longer, relevant.

<!-- Valid values an empty string or hidden -->
<progress hidden>Progress info</progress> 
<progress hidden="hidden">Progress info</progress> 
<progress> Event Attributes
Attribute Description Example
Document Element
oncopyThe script to be run when the user copies the content of an element.

 <!-- Executes go() function -->
<progress oncopy="go()">Progress info</progress> 
oncutThe script to be run when the user cuts the content of an element.

 <!-- Executes go() function -->
<progress oncut="go()">Progress info</progress>
onpasteThe script to be run when the user pastes some content into an element.

 <!-- Executes go() function -->
<progress onpaste="go()">Progress info</progress>
Drag and Drop
ondragThe script to be run when an element is dragged.

 <!-- Executes go() function -->
<progress ondrag="go()">Progress info</progress>
ondragendThe script to be run when an element has stopped being dragged.

 <!-- Executes go() function -->
<progress ondragend="go()">Progress info</progress>
ondragenterThe script to be run when an element has been dragged to a valid drop target.

 <!-- Executes go() function -->
<progress ondragenter="go()">Progress info</progress>
ondragleaveThe script to be run when an element leaves a valid drop target.

 <!-- Executes go() function -->
<progress ondragleave="go()">Progress info</progress>
ondragoverThe script to be run when an element is being dragged over a valid drop target.

 <!-- Executes go() function -->
<progress ondragover="go()">Progress info</progress>
ondragstartThe script to be run at the start of a drag operation.

 <!-- Executes go() function -->
<progress ondragstart="go()">Progress info</progress>
ondropThe script to be run when a dragged element is being dropped.

 <!-- Executes go() function -->
<progress ondrop="go()">Progress info</progress>
Form
onblurThe script to be run when the element loses focus.

 <!-- Executes go() function -->
<progress onblur="go()">Progress info</progress>
onchangeThe script to be run when object changed and attempt to leave field.

 <!-- Executes go() function -->
<progress onchange="go()">Progress info</progress>
oncontextmenuThe script to be run when a context menu is triggered.

 <!-- Executes go() function -->
<progress oncontextmenu="go()">Progress info</progress>
onfocusThe script to be run when the element gets focus.

 <!-- Executes go() function -->
<progress onfocus="go()">Progress info</progress>
oninputThe script to be run when an element gets user input.

 <!-- Executes go() function -->
<progress oninput="go()">Progress info</progress>
oninvalidThe script to be run when an element is invalid.

 <!-- Executes go() function -->
<progress oninvalid="go()">Progress info</progress>
onresetThe script to be run when a dragged element is being dropped.

 <!-- Executes go() function -->
<progress onreset="go()">Progress info</progress>
onselectThe script to be run when some or all of the contents of an object are selected.

 <!-- Executes go() function -->
<progress onselect="go()">Progress info</progress>
onsubmitThe script to be run when a form is submitted.

 <!-- Executes go() function -->
<progress onsubmit="go()">Progress info</progress>
Keyboard
onkeydownThe script to be run when an element is in focus and keyboard key is pressed down.

 <!-- Executes go() function -->
<progress onkeydown="go()">Progress info</progress>
onkeypressThe script to be run when an element is in focus and keyboard key is pressed down and released.

 <!-- Executes go() function -->
<progress onkeypress="go()">Progress info</progress>
onkeyupThe script to be run when an element is in focus and keyboard key is released.

 <!-- Executes go() function -->
<progress onkeyup="go()">Progress info</progress>
Media
onabortThe script code to be run on abort.

 <!-- Executes go() function -->
<progress onabort="go()">Progress info</progress>
oncanplayThe script to be run when a file has buffered enough so it is ready to start playing.

 <!-- Executes go() function -->
<progress oncanplay="go()">Progress info</progress>
oncanplaythroughThe script to be run when a file can be played all the way to the end without further need of buffering.

 <!-- Executes go() function -->
<progress oncanplaythrough="go()">Progress info</progress>
oncuechangeThe script to be run when the cue changes when using the track element.

 <!-- Executes go() function -->
<progress oncuechange="go()">Progress info</progress>
ondurationchangeThe script to be run when the length of the media is changed.

 <!-- Executes go() function -->
<progress ondurationchange="go()">Progress info</progress>
onemptiedThe script to be run when a media resource element suddenly becomes empty, usually due to an error.

 <!-- Executes go() function -->
<progress onemptied="go()">Progress info</progress>
onendedThe script to be run when the media has reach the end.

 <!-- Executes go() function -->
<progress onended="go()">Progress info</progress>
onloadeddataThe script to be run when media data is loaded and playback can start.

 <!-- Executes go() function -->
<progress onloadeddata="go()">Progress info</progress>
onloadedmetadataThe script to be run when metadata has been loaded.

 <!-- Executes go() function -->
<progress onloadedmetadata="go()">Progress info</progress>
onloadstartThe script to be run whenthe media resource has started loading.

 <!-- Executes go() function -->
<progress onloadstart="go()">Progress info</progress>
onpauseThe script to be run when the media resource has been paused.

 <!-- Executes go() function -->
<progress onpause="go()">Progress info</progress>
onplayThe script to be run when the media resource starts playback.

 <!-- Executes go() function -->
<progress onplay="go()">Progress info</progress>
onplayingThe script to be run when when playback has already begun.

 <!-- Executes go() function -->
<progress onplaying="go()">Progress info</progress>
onprogressThe script to be run when the browser is fetching the media data.

 <!-- Executes go() function -->
<progress onprogress="go()">Progress info</progress>
onratechangeThe script to be run when the playback rate changes.

 <!-- Executes go() function -->
<progress onratechange="go()">Progress info</progress>
onseekedThe script to be run when the seeking attribute is set to false indicating that seeking has finished.

 <!-- Executes go() function -->
<progress onseeked="go()">Progress info</progress>
onseekingThe script to be run when the seeking attribute is set to true indicating that seeking is currently active.

 <!-- Executes go() function -->
<progress onseeking="go()">Progress info</progress>
onstalledThe script to be run when the browser is unable to continue fetching media data.

 <!-- Executes go() function -->
<progress onstalled="go()">Progress info</progress>
onsuspendThe script to be run when media data has stopped before being completely loaded.

 <!-- Executes go() function -->
<progress onsuspend="go()">Progress info</progress>
ontimeupdateThe script to be run when the media resources current playback position has changed.

 <!-- Executes go() function -->
<progress ontimeupdate="go()">Progress info</progress>
onvolumechangeThe script to be run when the volume has changed or been muted.

 <!-- Executes go() function -->
<progress onvolumechange="go()">Progress info</progress>
onwaitingThe script to be run when the media resource has paused but is expected to resume.

 <!-- Executes go() function -->
<progress onwaiting="go()">Progress info</progress>
Mouse
onclickThe script to be run when when a mouse is clicked on an element.

 <!-- Executes go() function -->
<progress onclick="go()">Progress info</progress>
ondblclickThe script to be run when a mouse is double clicked on an element.

 <!-- Executes go() function -->
<progress ondblclick="go()">Progress info</progress>
onmousedownThe script to be run when he mouse button is pressed down while the cursor is over an element.

 <!-- Executes go() function -->
<progress onmousedown="go()">Progress info</progress>
onmousemoveThe script to be run when the mouse button is moved.

 <!-- Executes go() function -->
<progress onmousemove="go()">Progress info</progress>
onmouseoutThe script to be run when the mouse cursor moves off an element.

 <!-- Executes go() function -->
<progress onmouseout="go()">Progress info</progress>
onmouseoverThe script to be run when the mouse cursor moves over an element.

 <!-- Executes go() function -->
<progress onmouseover="go()">Progress info</progress>
onmouseupThe script to be run when the mouse button is released while the cursor is over the element.

 <!-- Executes go() function -->
<progress onmouseup="go()">Progress info</progress>
onwheelThe script to be run when the mouse wheel rolls up or down over an element.

 <!-- Executes go() function -->
<progress onwheel="go()">Progress info</progress>
Scroll
onscrollThe script code to be run when the scrollbar of an element is being scrolled.

 <!-- Executes go() function -->
<progress onscroll="go()">Progress info</progress> 
Window - NONE

Relevant HTML Tutorials

HTML Advanced - Graphics & Visuals