optimum attribute | optimum property
Specifies what the optimal range is for a meter element.
![]() |
Syntax
| HTML |
|---|
<element optimum="p" ... > |
Property values
Type: Number
A valid floating point that specifies the optimum position of a meter element.
Standards information
Remarks
The value of optimum must be greater than the min value and less than the max values.
If the optimum value is higher than the high attribute, then this indicates to the meter that the higher a value is, the better. If the optimum value is below the low attribute, then this indicates that the lower the value, the better. If the value falls between the low and the high attributes then neither high nor low values are good.
Examples
In this example, the optimum value is set to be 0. This means the goal is to be at 0 for this meter, so the closer to 0 the value is, the better. For this example, any value less than or equal to the low attribute will make the bar green. Any value above the low attribute and less than the high attribute will make the bar yellow. Any value above the high attribute will make the bar red. This example will produce a meter element that is 30% full with a green bar.
<meter value="30" min="0" max="100" low="30" high="90" optimum="0"></meter>
See also
