Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons
  • Teach on BraveProgrammer

© 2026 BraveProgrammer. All rights reserved.

Using `<meter>` and `<progress>` for UI | HTML Course lesson | BraveProgrammer
  1. Courses
  2. /
  3. HTML Course

Lesson 46 of 55

·HTML

Using `<meter>` and `<progress>` for UI Elements

9 min

Course progress84%

What you'll learn

Keep these ideas in mind as you work through the lesson.

5 points
  • When to use `<meter>` for scalar measurements and `<progress>` for task completion
  • Attributes for range, low/high, optimum (meter) and max/value (progress)
  • Updating values via JavaScript and handling indeterminate state
  • Styling native UI elements with vendor‑specific pseudo‑elements
  • Ensuring accessibility with proper labels and reduced‑motion support

Native UI Indicators – <meter> & <progress>

<label for='fuel'>Fuel level</label>
<meter id='fuel' min='0' max='100' low='20' high='80' optimum='50' value='45'>45%</meter>

<label for='upload'>Upload progress</label>
<progress id='upload' max='100' value='70'>70%</progress>

<meter>

  • Represents a scalar measurement within a known range (e.g., battery, rating).
  • Supports low, high, and optimum attributes to visually indicate status.
  • Browsers render a simple bar; you can style it with vendor‑specific pseudo‑elements (see below).

<progress>

  • Shows task completion (file upload, form submission).
  • Updated via JavaScript:
const prog = document.getElementById('upload');
let percent = 0;
const interval = setInterval(() => {
  percent += 10;
  prog.value = percent;
  if (percent >= 100) clearInterval(interval);
}, 500);
  • value may be omitted for indeterminate progress (spinner).

Styling (vendor‑specific)

/* Chrome & Safari */
progress::-webkit-progress-bar { background: #eee; }
progress::-webkit-progress-value { background: #3b82f6; }
/* Firefox */
progress::-moz-progress-bar { background: #3b82f6; }

Make sure the styling respects prefers‑reduced‑motion for users who disable animations.


Quick checklist for native UI elements

  1. <meter> used for scalar values with proper min, max, and value? ✅
  2. <progress> updated via JavaScript and handling indeterminate state? ✅
  3. Styling applied with appropriate vendor prefixes? ✅
  4. Accessibility labels (aria-label or <label for>) present? ✅
  5. prefers-reduced-motion respected in any animated styling? ✅

Tip: Prefer native elements over custom JS‑only progress bars because they inherit keyboard and screen‑reader support automatically.

Make it stickPractice what you've learned1 quiz · 2 practical tests · Optional activities from HTML CourseBrowse activities
Previous lessonInline Text TagsContinue to lesson 47The `<track>` Element – Subtitles and CaptionsBack to HTML Course curriculum