Lesson 46 of 55
HTMLUsing `<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.
Lesson 46 of 55
HTML9 min
Keep these ideas in mind as you work through the lesson.
<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>low, high, and optimum attributes to visually indicate status.<progress>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)./* 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.
<meter> used for scalar values with proper min, max, and value? ✅<progress> updated via JavaScript and handling indeterminate state? ✅aria-label or <label for>) present? ✅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.