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>
<p><label for="fuel_level">Fuel Gauge</label>
<meter id="fuel_level" value="75" low="20" high="80" min="1" max="100">75</meter></p>
<label for="capacity">Seating Capacity</label>
<meter id="capacity" value="126" min="0" max="235" optimum="235">25</meter>
10%

75

25

Attributes

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


<meter> Specific Attributes
Attribute Value Description Example
highnumberSpecifies a value considered high for the range.

<meter id="volume" high="80">Meter value</meter>
lownumberSpecifies a value considered low for the range.

<meter id="volume" low="10">Meter value</meter>
optimumnumberSpecifies a value considered best for the range.

<meter id="volume" optimum="50">Meter value</meter>
maxnumberSpecifies a maximum value for the upper boundary of the range.

<meter id="volume" max="100">Meter value</meter>
minnumberSpecifies a minumum value for the lower boundary of the range.

Default value 0

<meter id="volume" min="1">Meter value</meter>
valuenumberSpecifies the current value of the range. Required

<meter id="volume" value="85">Meter value</meter>
<meter> 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.

<meter class="name">Meter value</meter>
idSpecifies a unique id for the element allowing you to apply the style of the predefined id to the content.

<meter id="name">Meter value</meter>
styleSpecifies an inline style for the element allowing you to apply the style to the contentt.

<meter style="color:red;">Meter value</meter>
titleSpecifies an inline style for the element allowing you to apply the style to the content.

<meter title="Content info">Meter value</meter>
Keyboard
accesskeySpecifies a keyboard shortcut to associate with the element.

<meter accesskey="a">Meter value</meter>
tabindexSpecifies a tab order for the element.

<meter tabindex="1">Meter value</meter>
Language
dirSpecifies the directional flow of the content.

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

<meter lang="en">Meter value</meter>
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. -->
<meter spellcheck="true">Meter value</meter> 
translateSpecifies an inline style for the element allowing you to apply the style to the content.

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

<!-- Valid values true and false. -->
<!-- Default inherited. -->
<meter contenteditable="true">Meter value</meter> 
draggableSpecifies whether the element is draggable.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

 <!-- Executes go() function -->
<meter onkeyup="go()">Meter value</meter>
Media
onabortThe script code to be run on abort.

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

 <!-- Executes go() function -->
<meter oncanplay="go()">Meter value</meter>
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 -->
<meter oncanplaythrough="go()">Meter value</meter>
oncuechangeThe script to be run when the cue changes when using the track element.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

 <!-- Executes go() function -->
<meter onscroll="go()">Meter value</meter> 
Window - NONE

Relevant HTML Tutorials

HTML Advanced - Graphics & Visuals