The HTML5 Meter Element: A Complete Guide to Scalar Measurement Gauges

Learn how to use the native meter element to display disk usage, battery levels, scores, and other scalar measurements with semantic HTML.

What Is the Meter Element?

The <meter> element represents a scalar measurement within a known range or a fractional value. This is also known as a gauge. Unlike progress bars that indicate task completion over time, meters represent static values--like disk usage, battery levels, or test scores--at a specific point in time.

The meter element provides:

  • Native accessibility with automatic ARIA role assignment
  • Semantic meaning for better SEO and code clarity
  • Browser-native rendering without JavaScript dependencies
  • Multi-region color coding for visual feedback

When to Use Meter vs. Progress

Use CaseElementDescription
File upload progress<progress>Shows task completion over time
Disk usage display<meter>Static measurement within a range
Battery level<meter>Current state measurement
Form completion<progress>Temporal progress indicator

Key Distinction

Progress elements show how much of a task has been completed and typically animate as the task advances. Meter elements show a current measurement within a fixed range and remain static until programmatically updated. For building comprehensive web applications with semantic HTML elements, consider partnering with our /services/web-development/ team to ensure best practices across your codebase.

Essential Attributes

The meter element supports six key attributes that define its behavior and appearance. Understanding these attributes is crucial for effective implementation.

Value Attribute

The value attribute represents the current measurement. This is the only required attribute that must be explicitly set for the meter to be meaningful. The value must fall between the min and max boundaries.

<meter value="75" min="0" max="100">75%</meter>

Min and Max Attributes

The min attribute defines the lower bound of the measurement range (default: 0), while max defines the upper bound (default: 1). These create the range within which the value is displayed.

<meter min="10" max="200" value="85">85 GB used</meter>

Low and High Attributes

The low attribute defines the boundary between the low and medium portions, while high defines the boundary between the medium and high portions. These create three zones that browsers color-code.

<meter min="0" max="100" low="30" high="70" value="85">85/100</meter>

Optimum Attribute

The optimum attribute specifies the ideal value within the range. Combined with low and high, this determines color coding:

  • Green (optimal): Values in the zone containing optimum
  • Yellow (sub-optimal): Values adjacent to the optimum zone
  • Red (non-optimal): Values farthest from optimum
<meter min="0" max="100" low="40" high="80" optimum="95" value="25">25/100</meter>

In this example, with optimum at 95 (in the high zone), the meter will show the value in red since 25 is farthest from the optimum zone.

Complete Usage Examples

Simple Percentage Display

The most common use case is displaying a percentage within a 0-100 range.

<label for="battery">Battery Level:</label>
<meter id="battery" min="0" max="100" value="75">75%</meter>

Custom Range Measurement

For measurements outside the percentage model, define custom min and max values.

<label for="storage">Disk Usage:</label>
<meter id="storage" min="0" max="256" value="120" title="GB">120 GB of 256 GB</meter>

Multi-Region Grading System

Create a graded scale with low, high, and optimum to color-code results.

<label for="score">Test Score:</label>
<meter id="score" min="0" max="100" low="40" high="80" optimum="95" value="72">72/100</meter>

With optimum at 95 (in the high zone), values in the high zone appear green, values in the low zone appear yellow, and values below low appear red.

Battery Level Indicator

<label for="battery-level">Battery Status:</label>
<meter id="battery-level" min="0" max="100" low="20" high="80" optimum="90" value="15" title="Percentage">
 15% remaining
</meter>

For web applications that leverage device APIs like battery status, semantic HTML elements provide the foundation for building accessible, standards-compliant interfaces that work across all modern browsers.

Basic Meter Implementation
1<!-- Simple percentage meter -->2<label for="disk-usage">Disk Usage:</label>3<meter id="disk-usage" min="0" max="500" value="285" title="GB">4 285 GB of 500 GB used5</meter>6 7<!-- Multi-region grading meter -->8<label for="exam-score">Exam Score:</label>9<meter id="exam-score" 10 min="0" 11 max="100" 12 low="40" 13 high="80" 14 optimum="95" 15 value="72">16 72/10017</meter>18 19<!-- Battery level with color zones -->20<label for="battery">Battery:</label>21<meter id="battery" 22 min="0" 23 max="100" 24 low="20" 25 high="80" 26 optimum="90" 27 value="15">28 15% remaining29</meter>

Browser Support and Compatibility

Current Browser Coverage

The meter element is supported across all modern browsers:

BrowserSupportNotes
Chrome/EdgeFullWebKit pseudo-elements available
FirefoxFullMozilla pseudo-elements available
SafariFullWebKit pseudo-elements available
OperaFullWebKit-based
Internet ExplorerNoneRequires fallback

Accessibility Considerations

The meter element has an implicit ARIA role of meter, making it automatically accessible to screen readers without additional markup.

Key accessibility features:

  • Automatic role="meter" assignment
  • Screen readers announce current value and range
  • Fallback text provides textual representation
  • Associated labels improve usability
<label for="storage-meter">Storage Used:</label>
<meter id="storage-meter" min="0" max="100" value="65">
 65 GB of 100 GB used
</meter>

Implementing semantic HTML elements with proper ARIA roles is a core practice in our /services/web-development/ approach, ensuring all users can access your content regardless of their assistive technology.

Styling Techniques for Modern Browsers

WebKit/Blink Pseudo-Elements

Chrome, Safari, and other WebKit-based browsers use vendor-specific pseudo-elements for styling.

/* Reset default appearance */
meter {
 -webkit-appearance: none;
 width: 300px;
 height: 25px;
}

/* Style the meter bar container */
meter::-webkit-meter-bar {
 background: #f0f0f0;
 border-radius: 4px;
 box-shadow: inset 0 1px 3px rgba(0,0,0,0.2);
}

/* Style optimal value (green zone) */
meter::-webkit-meter-optimum-value {
 background: linear-gradient(#8bcf69, #6abf4a);
 border-radius: 4px;
}

/* Style sub-optimal value (yellow zone) */
meter::-webkit-meter-suboptimum-value {
 background: linear-gradient(#e6d450, #d4c03d);
 border-radius: 4px;
}

/* Style non-optimal value (red zone) */
meter::-webkit-meter-even-less-good-value {
 background: linear-gradient(#f28f68, #e07050);
 border-radius: 4px;
}

Firefox Pseudo-Elements

Firefox uses different pseudo-element selectors:

/* Firefox meter styling */
meter {
 -moz-appearance: none;
 width: 300px;
 height: 25px;
 background: #f0f0f0;
 border-radius: 4px;
 box-shadow: inset 0 1px 3px rgba(0,0,0,0.2);
}

/* Firefox value styling */
meter::-moz-meter-bar {
 background: linear-gradient(#8bcf69, #6abf4a);
 border-radius: 4px;
}

meter:-moz-meter-optimum::-moz-meter-bar {
 background: linear-gradient(#8bcf69, #6abf4a);
}

meter:-moz-meter-sub-optimum::-moz-meter-bar {
 background: linear-gradient(#e6d450, #d4c03d);
}

meter:-moz-meter-sub-sub-optimum::-moz-meter-bar {
 background: linear-gradient(#f28f68, #e07050);
}

Fallback Strategies for Unsupported Browsers

HTML Fallback Technique

For browsers without meter support (notably all versions of Internet Explorer), include fallback content inside the meter tag. Modern browsers ignore this content, while older browsers render it.

<meter min="0" max="100" value="65">
 <div class="meter-fallback">
 <span style="width: 65%;">65%</span>
 </div>
</meter>

<style>
.meter-fallback {
 display: inline-block;
 width: 200px;
 height: 20px;
 background: #f0f0f0;
 border: 1px solid #ccc;
 border-radius: 3px;
}
.meter-fallback span {
 display: block;
 height: 100%;
 background: #8bcf69;
 text-indent: -9999px;
}
</style>

JavaScript Feature Detection

Use JavaScript to detect meter support and apply fallbacks programmatically:

if (!('value' in document.createElement('meter'))) {
 // Apply polyfill or fallback styles
 document.querySelectorAll('meter').forEach(function(meter) {
 meter.classList.add('meter-fallback');
 });
}

Performance Benefits

Native Element Advantages

Using the native <meter> element provides significant performance advantages:

BenefitDescription
No JavaScript requiredBasic display works without any script
Hardware-acceleratedBrowser handles rendering efficiently
Smaller bundleNo external gauge libraries needed
Auto accessibilityARIA role automatically applied
Consistent renderingSame behavior across sessions
Reduced DOM manipulationNo JS-based updates needed

SEO Considerations

Semantic HTML using proper elements like <meter> improves search engine understanding. The native element provides clear semantic meaning that custom <div> structures cannot match without extensive ARIA attributes. Our team follows these semantic HTML best practices across all projects in our /services/seo-services/ to maximize search visibility.

Best Practices for Implementation

Always Include Fallback Text

Include descriptive text inside the meter element for browsers that don't support it and for screen readers.

<meter min="0" max="100" value="42">42% complete (42 out of 100)</meter>

Use the Title Attribute

Add a title attribute to provide additional context and tooltip information.

<meter min="0" max="1000" value="750" title="Storage used in GB">750 GB</meter>

Associate with Labels

Always associate meter elements with labels using standard form labeling practices.

<label for="storage-meter">Storage Used:</label>
<meter id="storage-meter" min="0" max="500" value="285" title="GB">285 GB</meter>

Color Psychology

When using low/high/optimum attributes, ensure color associations match user expectations:

  • Green: Good/optimal status
  • Yellow: Caution/sub-optimal status
  • Red: Warning/poor status

Test Across Browsers

Verify meter appearance across target browsers, as native styling varies between Chrome, Firefox, and Safari. Consider custom CSS for consistent branding.

Common Use Cases

System Resource Monitoring

Display disk usage, memory utilization, or network bandwidth in system dashboards and admin panels.

Health and Fitness

Show progress toward fitness goals, daily step counts, or calorie limits as percentage-based gauges.

E-Commerce and Reviews

Display product ratings, seller scores, or customer satisfaction metrics using multi-region meters.

Educational Applications

Present quiz scores, completion percentages, or skill level assessments with color-coded feedback.

Financial Dashboards

Show budget utilization, credit limits, or savings progress with clear visual indicators.

Game Statistics

Display player stats, health bars, or skill progression meters in gaming interfaces.

Advanced Styling Examples

Custom Dimensions

Meters can be resized using standard CSS properties.

meter {
 width: 100%;
 max-width: 400px;
 height: 30px;
}

Rounded Corners and Borders

Customize appearance to match your design system.

meter {
 -webkit-appearance: none;
 border-radius: 8px;
 border: 2px solid #e0e0e0;
 overflow: hidden;
}

Custom Gradients

Apply visual effects to match brand guidelines.

meter::-webkit-meter-optimum-value {
 background: linear-gradient(
 180deg,
 #4CAF50 0%,
 #45a049 50%,
 #3d8b40 100%
 );
 box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

Conclusion

The HTML5 <meter> element provides a semantic, accessible, and performant solution for displaying scalar measurements. Its native browser support eliminates the need for complex JavaScript gauge libraries while automatically handling accessibility requirements.

Key Takeaways

  1. Use meter for static measurements, not progress over time
  2. Configure all six attributes for complete control
  3. Use CSS pseudo-elements for cross-browser styling
  4. Include fallback content for IE compatibility
  5. Associate labels for accessibility

With proper attribute configuration and optional CSS styling, meters can effectively communicate measurement data--from simple percentage displays to complex multi-region scoring systems. For more advanced CSS techniques and animation controls, explore our guide on /resources/guides/web-development/controlling-css-animations-transitions-javascript/.

Need Help Implementing Modern HTML5 Elements?

Our web development team specializes in building performant, accessible websites using the latest web standards.

Frequently Asked Questions