Lesson 31 of 60 – Bootstrap Progress Bars
52%

Bootstrap Progress Bars

Bootstrap Progress Bars are used to display the progress of a task, process, download, upload, course, project, or any other activity. They visually show how much of a task has been completed.

Note: Bootstrap Progress Bars use the .progress container and the .progress-bar element. The width of the progress bar is normally controlled using CSS or inline styles.

1. What Is a Progress Bar?

A Progress Bar is a visual indicator that shows the completion level of a task.

For example, a Progress Bar can show:

  • 25% completed
  • 50% completed
  • 75% completed
  • 100% completed

Progress Bars are useful in websites, dashboards, learning platforms, file uploads, downloads, and project management systems.

2. Basic Progress Bar

The basic Bootstrap Progress Bar uses a .progress container and a .progress-bar child.

<div class="progress">

    <div
    class="progress-bar"
    style="width: 50%;">

    </div>

</div>

3. The .progress Class

The .progress class creates the background container for the Progress Bar.

<div class="progress">

    ...

</div>

The container provides the track or background area in which the progress indicator is displayed.

4. The .progress-bar Class

The .progress-bar class creates the actual progress indicator.

<div class="progress">

    <div
    class="progress-bar"
    style="width: 70%;">

    </div>

</div>

5. Setting Progress Width

The width of a Progress Bar determines how much progress is shown.

<div
class="progress-bar"
style="width: 25%;">

</div>

The value 25% means that the Progress Bar occupies one-quarter of its available width.

6. 10% Progress Bar

A Progress Bar can represent a small amount of completed work.

<div class="progress">

    <div
    class="progress-bar"
    style="width: 10%;">

    10%

    </div>

</div>
10%

7. 25% Progress Bar

A 25% Progress Bar indicates that approximately one-quarter of the task has been completed.

<div class="progress">

    <div
    class="progress-bar"
    style="width: 25%;">

    25%

    </div>

</div>
25%

8. 50% Progress Bar

A 50% Progress Bar represents half of the available progress.

<div class="progress">

    <div
    class="progress-bar"
    style="width: 50%;">

    50%

    </div>

</div>
50%

9. 75% Progress Bar

A 75% Progress Bar indicates that most of the task has been completed.

<div class="progress">

    <div
    class="progress-bar"
    style="width: 75%;">

    75%

    </div>

</div>
75%

10. 100% Progress Bar

A 100% Progress Bar represents a completed task.

<div class="progress">

    <div
    class="progress-bar"
    style="width: 100%;">

    100%

    </div>

</div>
100%

11. Progress Bar with Percentage Text

You can place text inside the Progress Bar to show the percentage.

<div class="progress">

    <div
    class="progress-bar"
    style="width: 60%;">

    60%

    </div>

</div>
60%

Displaying the percentage makes the progress value easier to understand.

12. Contextual Progress Bar Colors

Bootstrap contextual classes can be used to change the appearance of a Progress Bar.

Common classes include:

  • bg-primary
  • bg-success
  • bg-info
  • bg-warning
  • bg-danger
  • bg-secondary
  • bg-dark
<div
class="progress-bar bg-success"
style="width: 70%;">

70%

</div>

13. Primary Progress Bar

The bg-primary class gives the Progress Bar the primary Bootstrap background color.

<div class="progress">

    <div
    class="progress-bar bg-primary"
    style="width: 60%;">

    60%

    </div>

</div>
60%

14. Success Progress Bar

The bg-success class can be used to represent successful or positive progress.

<div
class="progress-bar bg-success"
style="width: 80%;">

80%

</div>
80%

15. Warning Progress Bar

The bg-warning class can be used when progress needs a warning-style visual appearance.

<div
class="progress-bar bg-warning text-dark"
style="width: 55%;">

55%

</div>
55%

16. Danger Progress Bar

The bg-danger class gives the Progress Bar a danger context.

<div
class="progress-bar bg-danger"
style="width: 35%;">

35%

</div>
35%

17. Multiple Progress Bars

Multiple Progress Bars can be placed inside the same Progress container to represent different parts of a total.

<div class="progress">

    <div
    class="progress-bar bg-success"
    style="width: 40%;">

    40%

    </div>

    <div
    class="progress-bar bg-warning text-dark"
    style="width: 30%;">

    30%

    </div>

    <div
    class="progress-bar bg-danger"
    style="width: 20%;">

    20%

    </div>

</div>
40%
30%
20%

18. Striped Progress Bar

Use .progress-bar-striped to add a striped visual effect to the Progress Bar.

<div class="progress">

    <div
    class="progress-bar
    progress-bar-striped"
    style="width: 70%;">

    70%

    </div>

</div>
70%

19. Striped Success Progress Bar

The striped style can be combined with contextual background classes.

<div
class="progress-bar
progress-bar-striped
bg-success"
style="width: 80%;">

80%

</div>
80%

20. Animated Striped Progress Bar

Use .progress-bar-animated together with .progress-bar-striped to create an animated striped Progress Bar.

<div
class="progress-bar
progress-bar-striped
progress-bar-animated"
style="width: 75%;">

75%

</div>
75%
Note: Animated progress indicators should be used carefully. For users who prefer reduced motion, consider respecting the user's motion preferences.

21. Progress Bar Height

The height of a Progress Bar can be customized using CSS.

<div
class="progress"
style="height: 30px;">

    <div
    class="progress-bar"
    style="width: 60%;">

    60%

    </div>

</div>
60%

Bootstrap does not require a separate utility class for every custom Progress Bar height. Custom CSS or inline style can be used when needed.

22. Course Completion Progress

Progress Bars are useful in learning management systems to show how much of a course a student has completed.

<div class="progress">

    <div
    class="progress-bar bg-success"
    style="width: 65%;">

    65% Complete

    </div>

</div>
65% Complete

23. File Upload Progress

A Progress Bar can visually show the progress of a file upload.

<div class="progress">

    <div
    class="progress-bar bg-info"
    style="width: 45%;">

    Uploading 45%

    </div>

</div>
Uploading 45%

In a real application, the displayed percentage should be updated according to the actual upload progress.

24. Project Completion Progress

Project dashboards can use Progress Bars to display the completion status of different projects.

<p>
Website Development
</p>

<div class="progress">

    <div
    class="progress-bar bg-primary"
    style="width: 80%;">

    80%

    </div>

</div>

Website Development

80%

25. Progress Bars with Labels

A label can be placed above a Progress Bar to explain what the percentage represents.

<div class="mb-3">

    <div class="d-flex
    justify-content-between">

        <span>
        HTML
        </span>

        <span>
        90%
        </span>

    </div>

    <div class="progress">

        <div
        class="progress-bar
        bg-success"
        style="width: 90%;">

        </div>

    </div>

</div>
HTML 90%
CSS 75%

26. Dynamic Progress Bar with PHP

In a PHP application, the Progress Bar width can be generated from a variable.

<?php

$progress = 70;

?>

<div class="progress">

    <div
    class="progress-bar bg-success"
    style="width:
    <?php echo $progress; ?>%;">

    <?php echo $progress; ?>%

    </div>

</div>

The value of $progress can come from a database or another application process.

27. Progress Bar Accessibility

Progress indicators should provide useful information to users of assistive technologies as well as visual users.

Useful ARIA attributes include:

  • role="progressbar"
  • aria-valuenow
  • aria-valuemin
  • aria-valuemax
<div
class="progress-bar"
role="progressbar"
style="width: 60%;"
aria-valuenow="60"
aria-valuemin="0"
aria-valuemax="100">

60%

</div>

These attributes communicate the current progress value to assistive technology.

28. Common Progress Bar Mistakes

Avoid these common mistakes when creating Bootstrap Progress Bars:

  • Forgetting the .progress container.
  • Forgetting the .progress-bar class.
  • Using a width greater than 100% for normal completion progress.
  • Showing a percentage that does not match the actual width.
  • Using color as the only way to communicate status.
  • Using animation when it does not provide useful information.
  • Failing to provide accessible progress information.
  • Displaying progress that does not reflect the actual task.
Tip: The displayed percentage should match the actual progress of the operation whenever possible.

29. Practical Course Progress Dashboard

A learning platform can display separate Progress Bars for different courses.

<p>
HTML
</p>

<div class="progress mb-3">

    <div
    class="progress-bar bg-success"
    style="width: 90%;">

    90%

    </div>

</div>


<p>
CSS
</p>

<div class="progress mb-3">

    <div
    class="progress-bar bg-primary"
    style="width: 75%;">

    75%

    </div>

</div>


<p>
Bootstrap
</p>

<div class="progress">

    <div
    class="progress-bar bg-info"
    style="width: 50%;">

    50%

    </div>

</div>

HTML

90%

CSS

75%

Bootstrap

50%

30. Complete Bootstrap Progress Bar Example

This complete example combines labels, contextual colors, striped styles, and animated progress to create a practical dashboard.

<div class="mb-4">

    <div
    class="d-flex
    justify-content-between
    mb-1">

        <strong>
        HTML
        </strong>

        <span>
        90%
        </span>

    </div>

    <div class="progress">

        <div
        class="progress-bar
        bg-success
        progress-bar-striped"
        role="progressbar"
        style="width: 90%;"
        aria-valuenow="90"
        aria-valuemin="0"
        aria-valuemax="100">

        90%

        </div>

    </div>

</div>


<div class="mb-4">

    <div
    class="d-flex
    justify-content-between
    mb-1">

        <strong>
        CSS
        </strong>

        <span>
        75%
        </span>

    </div>

    <div class="progress">

        <div
        class="progress-bar
        bg-primary"
        role="progressbar"
        style="width: 75%;"
        aria-valuenow="75"
        aria-valuemin="0"
        aria-valuemax="100">

        75%

        </div>

    </div>

</div>


<div>

    <div
    class="d-flex
    justify-content-between
    mb-1">

        <strong>
        Bootstrap
        </strong>

        <span>
        50%
        </span>

    </div>

    <div class="progress">

        <div
        class="progress-bar
        bg-info
        progress-bar-striped
        progress-bar-animated"
        role="progressbar"
        style="width: 50%;"
        aria-valuenow="50"
        aria-valuemin="0"
        aria-valuemax="100">

        50%

        </div>

    </div>

</div>
HTML 90%
90%
CSS 75%
75%
Bootstrap 50%
50%

📌 Key Points

  • .progress creates the Progress Bar container.
  • .progress-bar creates the actual progress indicator.
  • The width determines the amount of displayed progress.
  • Percentage text can be placed inside the Progress Bar.
  • Contextual background classes can change its appearance.
  • .progress-bar-striped creates a striped effect.
  • .progress-bar-animated animates a striped Progress Bar.
  • Multiple Progress Bars can be combined in one container.
  • Progress Bars can show course, project, upload, and task progress.
  • PHP can dynamically generate Progress Bar values.
  • ARIA progress attributes improve accessibility.
  • Use meaningful labels when the percentage alone is not sufficient.
  • Progress values should accurately represent the actual task.
  • Avoid excessive animation and consider reduced-motion preferences.
  • Use Progress Bars to make completion status easy to understand.

🧠 Quick Quiz

Question: Which Bootstrap class creates the actual Progress Bar indicator?