- HTML Tutorial
- HTML - Home
- HTML - Introduction
- HTML - Editors
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Headings
- HTML - Paragraphs
- HTML - Fonts
- HTML - Blocks
- HTML - Style Sheet
- HTML - Formatting
- HTML - Quotations
- HTML - Comments
- HTML - Colors
- HTML - Images
- HTML - Image Map
- HTML - Iframes
- HTML - Phrase Elements
- HTML - Meta Tags
- HTML - Classes
- HTML - IDs
- HTML - Backgrounds
- HTML Tables
- HTML - Tables
- HTML - Headers & Caption
- HTML - Table Styling
- HTML - Table Colgroup
- HTML - Nested Tables
- HTML Lists
- HTML - Lists
- HTML - Unordered Lists
- HTML - Ordered Lists
- HTML - Definition Lists
- HTML Links
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML Color Names & Values
- HTML - Color Names
- HTML - RGB
- HTML - HEX
- HTML - HSL
- HTML Forms
- HTML - Forms
- HTML - Form Attributes
- HTML - Form Control
- HTML - Input Attributes
- HTML Media
- HTML - Video Element
- HTML - Audio Element
- HTML - Embed Multimedia
- HTML Header
- HTML - Head Element
- HTML - Adding Favicon
- HTML - Javascript
- HTML Layouts
- HTML - Layouts
- HTML - Layout Elements
- HTML - Layout using CSS
- HTML - Responsiveness
- HTML - Symbols
- HTML - Emojis
- HTML - Style Guide
- HTML Graphics
- HTML - SVG
- HTML - Canvas
- HTML APIs
- HTML - Geolocation API
- HTML - Drag & Drop API
- HTML - Web Workers API
- HTML - WebSocket
- HTML - Web Storage
- HTML - Server Sent Events
- HTML Miscellaneous
- HTML - MathML
- HTML - Microdata
- HTML - IndexedDB
- HTML - Web Messaging
- HTML - Web CORS
- HTML - Web RTC
- HTML Demo
- HTML - Audio Player
- HTML - Video Player
- HTML - Web slide Desk
- HTML Tools
- HTML - Velocity Draw
- HTML - QR Code
- HTML - Modernizer
- HTML - Validation
- HTML - Color Picker
- HTML References
- HTML - Cheat Sheet
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
- HTML Resources
- HTML - Quick Guide
- HTML - Useful Resources
- HTML - Color Code Builder
- HTML - Online Editor
HTML - optimum Attribute
HTML optimum attribute is used to specifies the range where the gauge value is considered to be an optimal value.
This attribute must be within the range (as defined by the min attribute and max attribute). For instance, if you're creating a meter to show CPU temperature, you might set min to 30, max to 100, and optimum to 60. This visually shows that temperatures around 60 degrees Celsius are considered ideal
The browser will change the color of the meter bar depending on whether the value is less than or equal to the optimum value.
Syntax
<meter optimum="value"></meter>
Where value is a floating-point number that represents the optimal value of the gauge.
Applies On
Below listed elements allow using of the HTML optimum attribute
Element | Description |
---|---|
<meter> | HTML <low> tag is used to render data within the given range. |
Examples of HTML optimum Attribute
Below examples will illustrate the HTML optimum attribute, where and how we should use this attribute!
Optimum value across high and low values
In the following example, we will notice color change of meter bar for various optimum values.
<!DOCTYPE html> <html> <body> <h2> 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.3" 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.7" high="0.5" low="0.2"> </meter> </p> </body> </html>
Manipulating value of meter Element based on optimum Value.
Considering the another scenario, where we are going to run the script the along with the optimum attribute. Here user can dynamically decrease value to meet target.
<!DOCTYPE html> <html lang="en"> <body> <p>Example of the 'low' attribute</p> <fieldset> <legend>Meter-high</legend> <label for="">Rahul's Work Load</label> <meter high="70" low="30" min="0" max="100" value="75" id='rahul'> </meter> <br><br> <span id='res'> Above Average Workload </span> <br><br> <button onclick="decrease()"> Reduce Tasks </button> </fieldset> <script> function decrease() { var h = document.getElementById('rahul'); var work = h.value; h.value = h.value - 10; var res = document.getElementById('res'); res.innerHTML = "Rahul's workload has decreased from " + work + " to " + h.value; } </script> </body> </html>
Supported Browsers
Attribute | |||||
---|---|---|---|---|---|
optimum | Yes 8.0 | No | Yes 6.0 | Yes 6.0 | Yes 11.0 |
To Continue Learning Please Login
Login with Google