HTML <meter> tagS2C Home   « HTML <meter> tag

Definition

The <meter> tag is used to define a scalar measurement with a finite range, or a fractional value; also known as a gauge.

Use the <label> HTML tag to give the meter/gauge a description and to aid accessibility.

The <meter> tag was introduced in HTML5.

Examples


<label for="volume">Volume</label>
<meter id="volume" value="10" optimum="50" low="20" high="80" min="1" max="100">10%</meter>
<label for="fuel_level">Fuel Gauge</label>
<meter id="fuel_level" value="75" low="20" high="80" min="1" max="100">75</meter>
<label for="capacity">Seating Capacity</label>
<meter id="capacity" value="126" min="0" max="235" optimum="235">25</meter>
10% 75 126

Required Attributes

value - specifies the current value of the range.


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

Optional Attributes

high - specifies a value considered high for the range.


<!-- ** The value must be a number ** -->
<meter id="volume" high="80"></meter>

low - specifies a value considered low for the range.


<!-- ** The value must be a number ** -->
<meter id="volume" low="10"></meter>

optimum - specifies a value considered best for the range.


<!-- ** The value must be a number ** -->
<meter id="volume" optimum="50"></meter>

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


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

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


<!-- ** The value must be a number - default value 0 ** -->
<meter id="volume" min="1">

Global Attributes

Common

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


<meter class="classname">Value amount here</meter>

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


<meter id="idname">Value amount here</meter>

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


<meter style="color:red;text-align:left">Value amount here</meter>

title - specifies extra information about the content.


<meter title="information about the content">Value amount here</meter>

Keyboard

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


<meter accesskey="aKeyValue">Value amount here</meter>
</meter>

tabindex - specifies a tab order for the element.


<meter tabindex="someNumber">Value amount here</meter>
</meter>

Language

dir - specifies the directional flow of the content.


   <!-- The text will flow from left to right -->
<meter dir="ltr">Value amount here</meter>

   <!-- The text will flow from right to left -->
<meter dir="rtl">Value amount here</meter>

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


<meter lang="en">Value amount here</meter>

xml:lang - specifies a language code for the content of the element in XHTML documents.


<meter xml:lang="fr">Value amount here</meter>

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


<!-- Valid values are true and  false - default is inherited / browser specific. -->
<meter spellcheck="true">Value amount here</meter>
</meter>

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


<!-- Valid values are yes and  no - default is yes. -->
<meter translate="no">Value amount here</meter>
</meter> 

Miscellaneous

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


<!-- Valid values are true and  false - default is inherited. -->
<meter contenteditable="false">Value amount here</meter>
</meter> 

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. -->
<meter draggable="true">Value amount here</meter>
</meter>

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


<!-- Valid values are an empty string or hidden -->
<meter hidden>Value amount here</meter>
</meter> 
<meter hidden="hidden">Value amount here</meter>
</meter> 

Event Attributes

Document

onabort - The JavaScript code to be run on abort.


<meter onabort="go()">Value amount here</meter>   <!-- Executes the go() function -->

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


<meter onerror="go()">Value amount here</meter>   <!-- Executes the go() function -->

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


<meter onload="go()">Value amount here</meter>   <!-- Executes the go() function -->

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


<meter onresize="go()">Value amount here</meter>   <!-- Executes the go() function -->

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


<meter onscroll="go()">Value amount here</meter>   <!-- Executes the go() function -->

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


<meter onunload="go()">Value amount here</meter>   <!-- Executes the go() function -->

Document Element

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


<meter oncopy="go()">Value amount here</meter>   <!-- Executes the go() function -->

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


<meter oncut="go()">Value amount here</meter>   <!-- Executes the go() function -->

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


<meter onpaste="go()">Value amount here</meter>   <!-- Executes the go() function -->

Drag and Drop

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


<meter ondrag="go()">Value amount here</meter>   <!-- Executes the go() function -->

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


<meter ondragend="go()">Value amount here</meter>   <!-- Executes the go() function -->

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


<meter ondragenter="go()">Value amount here</meter>   <!-- Executes the go() function -->

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


<meter ondragleave="go()">Value amount here</meter>   <!-- Executes the go() function -->

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


<meter ondragover="go()">Value amount here</meter>   <!-- Executes the go() function -->

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


<meter ondragstart="go()">Value amount here</meter>   <!-- Executes the go() function -->

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


<meter ondrop="go()">Value amount here</meter>   <!-- Executes the go() function -->

Form

onblur - The JavaScript code to be run on abort.


<meter onblur="go()">Value amount here</meter>   <!-- Executes the go() function -->

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


<meter onchange="go()">Value amount here</meter>   <!-- Executes the go() function -->

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


<meter oncontextmenu="go()">Value amount here</meter>   <!-- Executes the go() function -->

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


<meter onfocus="go()">Value amount here</meter>   <!-- Executes the go() function -->

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


<meter oninput="go()">Value amount here</meter>   <!-- Executes the go() function -->

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


<meter oninvalid="go()">Value amount here</meter>   <!-- Executes the go() function -->

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


<meter onreset="go()">Value amount here</meter>   <!-- Executes the go() function -->

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


<meter onselect="go()">Value amount here</meter>   <!-- Executes the go() function -->

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


<meter onsubmit="go()">Value amount here</meter>   <!-- Executes the go() function -->

Keyboard

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


<meter onkeydown="go()">Value amount here</meter>   <!-- 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.


<meter onkeypress="go()">Value amount here</meter>   <!-- Executes the go() function -->

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


<meter onkeyup="go()">Value amount here</meter>   <!-- 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.


<meter oncanplay="go()">Value amount here</meter>   <!-- 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.


<meter oncanplaythrough="go()">Value amount here</meter>   <!-- Executes the go() function -->

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


<meter oncuechange="go()">Value amount here</meter>   <!-- Executes the go() function -->

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


<meter ondurationchange="go()">Value amount here</meter>   <!-- Executes the go() function -->

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


<meter onemptied="go()">Value amount here</meter>   <!-- Executes the go() function -->

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


<meter onended="go()">Value amount here</meter>   <!-- Executes the go() function -->

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


<meter onloadeddata="go()">Value amount here</meter>   <!-- Executes the go() function -->

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


<meter onloadedmetadata="go()">Value amount here</meter>   <!-- Executes the go() function -->

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


<meter onloadstart="go()">Value amount here</meter>   <!-- Executes the go() function -->

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


<meter onpause="go()">Value amount here</meter>   <!-- Executes the go() function -->

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


<meter onplay="go()">Value amount here</meter>   <!-- Executes the go() function -->

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


<meter onplaying="go()">Value amount here</meter>   <!-- Executes the go() function -->

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


<meter onprogress="go()">Value amount here</meter>   <!-- Executes the go() function -->

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


<meter onratechange="go()">Value amount here</meter>   <!-- Executes the go() function -->

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


<meter onseeked="go()">Value amount here</meter>   <!-- 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.


<meter onseeking="go()">Value amount here</meter>   <!-- Executes the go() function -->

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


<meter onstalled="go()">Value amount here</meter>   <!-- Executes the go() function -->

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


<meter onsuspend="go()">Value amount here</meter>   <!-- Executes the go() function -->

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


<meter ontimeupdate="go()">Value amount here</meter>   <!-- Executes the go() function -->

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


<meter onvolumechange="go()">Value amount here</meter>   <!-- Executes the go() function -->

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


<meter onwaiting="go()">Value amount here</meter>   <!-- Executes the go() function -->

Mouse

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


<meter onclick="go()">Value amount here</meter>   <!-- Executes the go() function -->

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


<meter ondblclick="go()">Value amount here</meter>   <!-- 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.


<meter onmousedown="go()">Value amount here</meter>   <!-- Executes the go() function -->

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


<meter onmousemove="go()">Value amount here</meter>   <!-- Executes the go() function -->

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


<meter onmouseout="go()">Value amount here</meter>   <!-- Executes the go() function -->

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


<meter onmouseover="go()">Value amount here</meter>   <!-- Executes the go() function -->

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


<meter onmouseup="go()">Value amount here</meter>   <!-- Executes the go() function -->

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


<meter onwheel="go()">Value amount here</meter>   <!-- Executes the go() function -->

Window

NONE

go to home page Homepage go to top of page Top