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

Required Attributes

NONE

Optional Attributes

max - specifies a maximum value for the upper boundary of the range.


<!-- ** The value must be a number - default value 1 ** -->
<progress id="volume" max="100"></progress>

value - specifies the current value of the range.


<!-- ** The value must be a number ** -->
<progress id="volume" value="85"></progress>

Global Attributes

Common

class - specifies a classname for the element allowing you to apply the style of the predefined class to the content.


<progress class="classname">Progress text here</progress>

id - specifies a unique id for the element allowing you to apply the style of the predefined id to the content.


<progress id="idname">Progress text here</progress>

style - specifies an inline style for the element allowing you to apply the style to the content.


<progress style="color:red;text-align:left">Progress text here</progress>

title - specifies extra information about the content.


<progress title="information about the content">Progress text here</progress>

Keyboard

accesskey - specifies a keyboard shortcut to associate with the element.


<progress accesskey="aKeyValue">Variable name here</progress>

tabindex - specifies a tab order for the element.


<progress tabindex="someNumber">Variable name here</progress>

Language

dir - specifies the directional flow of the content.


<progress dir="ltr">Progress text here</progress>   <!-- The text will flow from left to right -->
<progress dir="rtl">Progress text here</progress>   <!-- The text will flow from right to left -->

lang - specifies a language code for the content of the element.


<progress lang="en">Progress text here</progress>

spellcheck - specifies whether the element is to have its spelling checked.


<!-- Valid values are true and  false - default is inherited / browser specific. -->
<progress spellcheck="true">Progress text heree</progress>

translate - specifies whether the content of the element can be translated.


<!-- Valid values are yes and  no - default is yes. -->
<progress translate="no">Progress text here</progress> 

Miscellaneous

contenteditable - specifies whether the content of the element is editable.


<!-- Valid values are true and  false - default is inherited. -->
<progress contenteditable="false">Progress text here</progress> 

draggable - specifies whether the the element is draggable.

Only text selections, images, and links can be dragged.


<!-- Valid values are true and  false - default is browser specific. -->
<progress draggable="true">Progress text here</progress>

hidden - specifies whether the element is not yet, or no longer, relevant.


<!-- Valid values are an empty string or hidden -->
<progress hidden>Progress text here</progress> 
<progress hidden="hidden">Progress text here</progress> 

Event Attributes

Document

onabort - The JavaScript code to be run on abort.


<progress onabort="go()">Progress text here</progress>   <!-- Executes the go() function -->

onerror - The JavaScript code to be run when an error occurs when the file is being loaded.


<progress onerror="go()">Progress text here</progress>   <!-- Executes the go() function -->

onload - The JavaScript code to be run when the document is loaded.


<progress onload="go()">Progress text here</progress>   <!-- Executes the go() function -->

onresize - The JavaScript code to be run when the browser window is resized.


<progress onresize="go()">Progress text here</progress>   <!-- Executes the go() function -->

onscroll - The JavaScript code to be run when the scrollbar of an element is being scrolled.


<progress onscroll="go()">Progress text here</progress>   <!-- Executes the go() function -->

onunload - The JavaScript code to be run once a page has unloaded or the browser window has been closed.


<progress onunload="go()">Progress text here</progress>   <!-- Executes the go() function -->

Document Element

oncopy - The JavaScript code to be run when the user copies the content of an element.


<progress oncopy="go()">Progress text here</progress>   <!-- Executes the go() function -->

oncut - The JavaScript code to be run when the user cuts the content of an element.


<progress oncut="go()">Progress text here</progress>   <!-- Executes the go() function -->

onpaste - The JavaScript code to be run when the user pastes some content into an element.


<progress onpaste="go()">Progress text here</progress>   <!-- Executes the go() function -->

Drag and Drop

ondrag - The JavaScript code to be run when an element is dragged.


<progress ondrag="go()">Progress text here</progress>   <!-- Executes the go() function -->

ondragend - The JavaScript code to be run when an element has stopped being dragged.


<progress ondragend="go()">Progress text here</progress>   <!-- Executes the go() function -->

ondragenter - The JavaScript code to be run when an element has been dragged to a valid drop target.


<progress ondragenter="go()">Progress text here</progress>   <!-- Executes the go() function -->

ondragleave - The JavaScript code to be run when an element leaves a valid drop target.


<progress ondragleave="go()">Progress text here</progress>   <!-- Executes the go() function -->

ondragover - The JavaScript code to be run when an element is being dragged over a valid drop target.


<progress ondragover="go()">Progress text here</progress>   <!-- Executes the go() function -->

ondragstart - The JavaScript code to be run at the start of a drag operation.


<progress ondragstart="go()">Progress text here</progress>   <!-- Executes the go() function -->

ondrop - The JavaScript code to be run when dragged element is being dropped.


<progress ondrop="go()">Progress text here</progress>   <!-- Executes the go() function -->

Form

onblur - The JavaScript code to be run on abort.


<progress onblur="go()">Progress text here</progress>   <!-- Executes the go() function -->

onchange - The JavaScript code to be run when object changed and attempt to leave field.


<progress onchange="go()">Progress text here</progress>   <!-- Executes the go() function -->

oncontextmenu - The JavaScript code to be run when a context menu is triggered.


<progress oncontextmenu="go()">Progress text here</progress>   <!-- Executes the go() function -->

onfocus - The JavaScript code to be run when the element gets focus.


<progress onfocus="go()">Progress text here</progress>   <!-- Executes the go() function -->

oninput - The JavaScript code to be run when an element gets user input.


<progress oninput="go()">Progress text here</progress>   <!-- Executes the go() function -->

oninvalid - The JavaScript code to be run when an element is invalid.


<progress oninvalid="go()">Progress text here</progress>   <!-- Executes the go() function -->

onreset - The JavaScript code to be run when the reset button of a form is clicked.


<progress onreset="go()">Progress text here</progress>   <!-- Executes the go() function -->

onselect - The JavaScript code to be run when some or all of the contents of an object are selected.


<progress onselect="go()">Progress text here</progress>   <!-- Executes the go() function -->

onsubmit - The JavaScript code to be run when a form is submitted.


<progress onsubmit="go()">Progress text here</progress>   <!-- Executes the go() function -->

Keyboard

onkeydown - The JavaScript code to be run when an element is in focus and keyboard key is pressed.


<progress onkeydown="go()">Progress text here</progress>   <!-- Executes the go() function -->

onkeypress - The JavaScript code to be run when an element is in focus and keyboard key is pressed down and released.


<progress onkeypress="go()">Progress text here</progress>   <!-- Executes the go() function -->

onkeyup - The JavaScript code to be run when an element is in focus and keyboard key is released.


<progress onkeyup="go()">Progress text here</progress>   <!-- Executes the go() function -->

Media

oncanplay - The JavaScript code to be run when a file has buffered enough so it is ready to start playing.


<progress oncanplay="go()">Progress text here</progress>   <!-- Executes the go() function -->

oncanplaythrough - The JavaScript code to be run when a file can be played all the way to the end without further need of buffering.


<progress oncanplaythrough="go()">Progress text here</progress>   <!-- Executes the go() function -->

oncuechange - The JavaScript code to be run when the cue changes when using the track element.


<progress oncuechange="go()">Progress text here</progress>   <!-- Executes the go() function -->

ondurationchange - The JavaScript code to be run when the length of the media is changed.


<progress ondurationchange="go()">Progress text here</progress>   <!-- Executes the go() function -->

onemptied - The JavaScript code to be run when a media resource element suddenly becomes empty, usually due to an error.


<progress onemptied="go()">Progress text here</progress>   <!-- Executes the go() function -->

onended - The JavaScript code to be run when the media has reach the end.


<progress onended="go()">Progress text here</progress>   <!-- Executes the go() function -->

onloadeddata - The JavaScript code to be run when media data is loaded and playback can start.


<progress onloadeddata="go()">Progress text here</progress>   <!-- Executes the go() function -->

onloadedmetadata - The JavaScript code to be run when metadata has been loaded.


<progress onloadedmetadata="go()">Progress text here</progress>   <!-- Executes the go() function -->

onloadstart - The JavaScript code to be run when the media resource has started loading.


<progress onloadstart="go()">Progress text here</progress>   <!-- Executes the go() function -->

onpause - The JavaScript code to be run when the media resource has been paused.


<progress onpause="go()">Progress text here</progress>   <!-- Executes the go() function -->

onplay - The JavaScript code to be run when the media resource starts playback.


<progress onplay="go()">Progress text here</progress>   <!-- Executes the go() function -->

onplaying - The JavaScript code to be run when playback has already begun.


<progress onplaying="go()">Progress text here</progress>   <!-- Executes the go() function -->

onprogress - The JavaScript code to be run when the browser is fetching the media data.


<progress onprogress="go()">Progress text here</progress>   <!-- Executes the go() function -->

onratechange - The JavaScript code to be run when the playback rate changes.


<progress onratechange="go()">Progress text here</progress>   <!-- Executes the go() function -->

onseeked - The JavaScript code to be run when the seeking attribute is set to false indicating that seeking has finished.


<progress onseeked="go()">Progress text here</progress>   <!-- Executes the go() function -->

onseeking - The JavaScript code to be run hen the seeking attribute is set to true indicating that seeking is currently active.


<progress onseeking="go()">Progress text here</progress>   <!-- Executes the go() function -->

onstalled - The JavaScript code to be run when the browser is unable to continue fetching media data.


<progress onstalled="go()">Progress text here</progress>   <!-- Executes the go() function -->

onsuspend - The JavaScript code to be run when media data has stopped before being completely loaded.


<progress onsuspend="go()">Progress text here</progress>   <!-- Executes the go() function -->

ontimeupdate - The JavaScript code to be run when the media resources current playback position has changed.


<progress ontimeupdate="go()">Progress text here</progress>   <!-- Executes the go() function -->

onvolumechange - The JavaScript code to be run when the volume has changed or been muted.


<progress onvolumechange="go()">Progress text here</progress>   <!-- Executes the go() function -->

onwaiting - The JavaScript code to be run when the media resource has paused but is expected to resume.


<progress onwaiting="go()">Progress text here</progress>   <!-- Executes the go() function -->

Mouse

onclick - The JavaScript code to be run when a mouse is clicked on the element.


<progress onclick="go()">Progress text here</progress>   <!-- Executes the go() function -->

ondblclick - The JavaScript code to be run when a mouse is double clicked on the element.


<progress ondblclick="go()">Progress text here</progress>   <!-- Executes the go() function -->

onmousedown - The JavaScript code to be run when the mouse button is pressed down while the cursor is over the element.


<progress onmousedown="go()">Progress text here</progress>   <!-- Executes the go() function -->

onmousemove - The JavaScript code to be run when the mouse button is moved.


<progress onmousemove="go()">Progress text here</progress>   <!-- Executes the go() function -->

onmouseout - The JavaScript code to be run when the mouse cursor moves off an element.


<progress onmouseout="go()">Progress text here</progress>   <!-- Executes the go() function -->

onmouseover - The JavaScript code to be run when the mouse cursor moves over an element.


<progress onmouseover="go()">Progress text here</progress>   <!-- Executes the go() function -->

onmouseup - The JavaScript code to be run when the mouse button is released while the cursor is over the element.


<progress onmouseup="go()">Progress text here</progress>   <!-- Executes the go() function -->

onwheel - The JavaScript code to be run when the mouse wheel rolls up or down over an element.


<progress onwheel="go()">Progress text here</progress>   <!-- Executes the go() function -->

Window

NONE

go to home page Homepage go to top of page Top