meter element | meter object

The meter element represents a scalar measurement within a specified range, or a fractional value. This information is displayed in the form of a horizontal bar, much like the progress element.

HTML5 A vocabulary and associated APIs for HTML and XHTML, Section 4.10.15

 

DOM Information

Inheritance Hierarchy

 Node
  Element
   HTMLElement
     meter

Members

The meter object has these types of members:

Properties

The meter object has these properties.

PropertyDescription

high

Specifies the high range for a meter element.

low

Specifies the low range for a meter element.

max

Specifies the upper bound of a meter element.

min

Specifies what the minimum bound of a meter element.

optimum

Specifies what the optimal range is for a meter element.

value

Specifies the measured value of a meter element.

 

Standards information

Remarks

A meter element must have a specified min, max, and value attribute.

The meter tag should not be used to indicate progress. Use the progress element to make progress bars.

While units can't be displayed, authors are encouraged to specify units using the title attribute.

A description for the meter element should be given within the tags. This text will act as a fallback for browsers that don't support the meter element.

If no min attribute is specified, by default it is set to 0. The min attribute specifies the lower bound of the meter, and must be below the max attribute.

If no max attribute is specified, by default it is set to 1. The max attribute specifies the upper bound of the meter, and must be above the min attribute.

Examples

The following example shows a meter element that is displaying the capacity of a ferry that is half full. The title attribute is used in this example to show the units of the meter upon mouse over.


Ferry 1 Capacity <meter min="0" max="300" value="150" title="cars">ferry 1 is 50% full</meter>

meter element green bar at 50%

This example shows three meter elements with all of their attributes included. With low, high, and optimum specified, the meter element will have three ranges. Because the optimum attribute value is 100, the closer to 100 value is, the better. Meter 1 will be red because its value falls in the range farthest from the optimum range, min to low. Meter 2 is yellow because its value falls in the range prior to the optimum range, low to high. Meter 3 is green because its value falls in the optimum range, high to max.


Meter 1 <meter min="0" max="100" value="29" low="30" high="90" optimum="100">Meter 1 is 29% full</meter>
Meter 2 <meter min="0" max="100" value="30" low="30" high="90" optimum="100">Meter 2 is 30% full</meter>
Meter 3 <meter min="0" max="100" value="90" low="30" high="90" optimum="100">Meter 3 is 90% full</meter>

three meter elements at red, yellow, green

See also

Node

 

 

Show: