/

HTML / CSS / JavaScript Tutorial

HTML Standard attribute: optimum

[this page | pdf | back links]

The HTML optimum attribute indicates the value that is deemed optimal for the gauge applicable to a <meter> element.

 

Valid attribute values (when used with <meter> elements) include:

 

Value

Description

number

(Floating point) number defining optimal value for gauge

 

EXAMPLE:


HTML USED IN THIS EXAMPLE:
<!DOCTYPE html>
<html> <!-- Copyright (c) Nematrian Limited 2018 -->
<head></head>
<body>
Created using HTML: (without and with an optimum attribute)<br>
<meter min="0" max="1" low="0.25" high="0.75" value="0.55"></meter><br>
<meter min="0" max="1" low="0.25" high="0.75" value="0.55" optimum="0.8"></meter>

<br><br>Created using JavaScript: (without and with an optimum attribute)<br>
<span id="element"></span><br>

<script>
var x = document.getElementById("element");
var x1 = document.createElement("METER");
x1.setAttribute("min", "0");
x1.setAttribute("max", "1");
x1.setAttribute("low", "0.25");
x1.setAttribute("high", "0.75");
x1.setAttribute("value", "0.55");
x.appendChild(x1);
var br1 = document.createElement("BR");
x.appendChild(br1);
var x2 = document.createElement("METER");
x2.setAttribute("min", "0");
x2.setAttribute("max", "1");
x2.setAttribute("low", "0.25");
x2.setAttribute("high", "0.75");
x2.setAttribute("value", "0.55");
x2.setAttribute("optimum", "0.8");
x.appendChild(x2);
</script>

</body>
</html>


NAVIGATION LINKS
Contents | Prev | Next | HTML Attributes


Desktop view | Switch to Mobile