Skip to content
Related Articles

Related Articles

How to define scalar measurement within a given range in HTML5 ?

View Discussion
Improve Article
Save Article
Like Article
  • Last Updated : 01 Apr, 2021

In this article, we will learn how to define an element that has a scalar measurement within a known range. It can be used to represent fractional data in a gauge making it easy for the reader to understand the values.


We will use the <meter> element for defining the gauge that can measure the scalar value. This element has attributes that can be used to define the value to represent, the lower and higher limits of the range and the preferred range of values. The color of the meter changes depending on the value it represents and the browser style.


<meter value="" min="" max=""></meter>

The below example illustrates the <meter> element to define a scalar measurement.



<!DOCTYPE html>
    <h1 style="color: green;">
    <p>Simple meter element</p>
    <meter value="3" min="0" max="10" 
        low="1" high="8">
    <p>Simple meter element with decimal value</p>
    <meter value="0.8" min="0" max="1"></meter>
        Meter element where the value is
        below low attribute
    <meter value="1" min="0" max="10" 
        low="3" high="9">
        Meter element where the value is
        above high attribute
    <meter value="10" min="0" max="10" 
        low="3" high="9">


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!