• We use the .progress as a wrapper to indicate the max value of the progress bar.
  • We use the inner .progress-bar to indicate the progress so far.
  • The .progress-bar also requires some role and aria attributes to make it accessible.

Put that all together, and you have the following examples.

Bootstrap provides a handful of . Depending on your needs, these may help with quickly configuring progress.

Progress - 图2

  1. <div class="progress">
  2. <div class="progress-bar w-75" role="progressbar" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100"></div>
  3. </div>

Labels

We only set a height value on the .progress, so if you change that value the inner .progress-bar will automatically resize accordingly.

Progress - 图4

  1. <div class="progress" style="height: 1px;">
  2. <div class="progress-bar" role="progressbar" style="width: 25%;" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
  3. </div>
  4. <div class="progress" style="height: 20px;">
  5. </div>

Backgrounds

Use background utility classes to change the appearance of individual progress bars.

Include multiple progress bars in a progress component if you need.

  1. <div class="progress-bar" role="progressbar" style="width: 15%" aria-valuenow="15" aria-valuemin="0" aria-valuemax="100"></div>
  2. <div class="progress-bar bg-success" role="progressbar" style="width: 30%" aria-valuenow="30" aria-valuemin="0" aria-valuemax="100"></div>
  3. <div class="progress-bar bg-info" role="progressbar" style="width: 20%" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100"></div>
  4. </div>

Striped

Add .progress-bar-striped to any .progress-bar to apply a stripe via CSS gradient over the progress bar’s background color.

Progress - 图7

  1. <div class="progress">