Open In App

HTML Optimum Attribute

Last Updated : 29 Aug, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

The HTML optimum attribute specifies the optimal numeric value for <meter elements. It's an optional attribute used to indicate the ideal or preferred value within a range, providing context for measurement.

Syntax:  

<meter optimum = "value"></meter>

Attribute Values: It contains the floating point number which represents the optimal value of the gauge.

Usage: The HTML optimum attribute defines an ideal value within the range of a `<meter>` element, indicating a preferred measurement relative to the low and high values.

HTML optimum attribute Example  

Example: Here is the basic implemantation of HTML optimum attribute.

HTML
<!DOCTYPE html>
<html>

<head>
    <title>HTML optimum Attribute</title>
</head>
<body>
    <h2 style="color: green;">
        HTML optimum Attribute
    </h2>
    <p>
        optimum value below low and high:
        <meter value="0.6" 
               max="0.9" 
               min="0.1" 
               optimum="0.1" 
               high="0.5" 
               low="0.2">
        </meter>
    </p>
    <p>
        optimum value between low and high:
        <meter value="0.6" 
               max="0.9" min="0.1" 
               optimum="0.4" 
               high="0.5" 
               low="0.2">
        </meter>
    </p>
    <p>
        optimum value above low and high:
        <meter value="0.6"
               max="0.9" 
               min="0.1" 
               optimum="0.6" 
               high="0.5" 
               low="0.2">
        </meter>
    </p>
</body>

</html>

Output:

HTML optimum attribute example output

Explanation:

  • This example includes a green-colored <h2> heading displaying "HTML optimum Attribute" for emphasis.
  • Three <meter> elements demonstrate different scenarios with the optimum attribute set relative to the low and high values.
  • Each <meter> visually represents a measurement within a specified range, highlighting the significance of the optimum attribute in indicating the preferred value.

HTML optimum attribute Use Cases:

1. How to specify the optimal value for the gauge in HTML5?

In HTML5, use the optimum attribute within the <meter> element to specify the optimal value for a gauge, indicating the preferred measurement within the defined range.

Supported Browsers:

The browser supported by value attribute in option tag are listed below:


Next Article

Similar Reads