← Back to Bootstrap Course | Chapter 7: Components — Cards & Alerts | Lesson 7 of 7

Progress bars

Progress bars show how far along a task is.

In this page:

  1. Progress bars
Syntax
markup
<div class="progress">
  <div class="progress-bar" role="progressbar" style="width: 50%">50%</div>
</div>

Progress bars

A .progress wrapper holds a .progress-bar whose width is set with an inline style (or the w-* utilities). Add role="progressbar" and aria-valuenow, aria-valuemin and aria-valuemax.

Striped and animated variants use .progress-bar-striped and .progress-bar-animated, and multiple bars can be stacked.

Note: Set the width style and aria-valuenow to the same percentage.

Example: Progress bars

markup
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body class="p-3">
<div class="container">
  <div class="progress mb-2" role="progressbar" aria-label="Basic" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"><div class="progress-bar" style="width: 25%">25%</div></div>
  <div class="progress mb-2" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100"><div class="progress-bar bg-success progress-bar-striped progress-bar-animated" style="width: 60%">60%</div></div>
  <div class="progress" style="height: 20px"><div class="progress-bar bg-info" style="width: 40%"></div><div class="progress-bar bg-warning" style="width: 20%"></div></div>
</div>
</body>
</html>
Live Example
Related Topics
Common Mistakes
  1. Missing ARIA values
  2. Mismatched width and aria-valuenow
  3. Overusing animated stripes
Chapter Summary
  • progress wraps progress-bar
  • Width shows the percentage
  • ARIA attributes describe it
  • Striped and animated variants
🔒

Chapter Quiz — Complete all 7 topics to unlock

0/7 topics done

Complete these topics first:

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.