Bootstrap progress bars point to the progress of the current action/task.
General Syntax
<div class="progress">
<div class="progress-bar" role="progressbar" style="width: 25%;" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
</div>
Source Code
<div class="container mt-4">
<b class="text-center">Bootstrap Progress Bar</b>
<div class="row">
<div class="col-12 col-sm-12">
<div class="progress mt-5">
<div class="progress-bar" ></div>
</div>
</div>
<div class="col-12 col-sm-12">
<div class="progress mt-5">
<div class="progress-bar" style="width: 25%;"></div>
</div>
</div>
<div class="col-12 col-sm-12">
<div class="progress mt-5">
<div class="progress-bar" style="width: 50%;"></div>
</div>
</div>
</div>
</div>
To create a progress bar label, place text inside the .progress-bar
.
Example
General Syntax
<div class="progress">
<div class="progress-bar" style="width: 60%;">60%</div>
</div>
Source Code
<div class="container mt-4">
<p class="text-center mt-5">Bootstrap Progress Bar Label</p>
<div class="progress mt-5 mb-5">
<div class="progress-bar" style="width: 60%;">60%</div>
</div> <!--progress-->
</div><!--container-->
Code Explanation
To create a progress bar label, assign text information inside the element having .progress-bar
class.
The default height of the progress bar is 16 pixels. It can also be changed by assigning the CSS height property to the
.progress
element.
Example
Source Code
<div class="container mt-4">
<p class="text-center mt-4 mb-4">Bootstrap Progress Bar Height</p>
<!-- Progress bar with 1px height -->
<div class="progress mt-5" style="height: 22px;">
<div class="progress-bar" style="width: 50%;">height:22px</div>
</div>
<!-- Progress bar with 18px height -->
<div class="progress mt-5" style="height: 25px;">
<div class="progress-bar" style="width: 70%;">height:25px</div>
</div>
</div>
<!--container-->
Code Explanation
Progress bar height can be changed by providing CSS height property to the element having .progress
.
Bootstrap progress bar background color can be set using background utility classes.
Example
General Syntax
<div class="progress mb-2">
<div class="progress-bar bg-success" style="width: 25%;"></div>
</div>
Source Code
<div class="progress mt-4 mb-5">
<div class="progress-bar bg-success" style="width: 25%;"></div>
</div>
Code Explanation
Note: Assign bg-*
to the element having .progress-bar
to create the different colored progress bar.
It includes more than one progress bar inside a progress component.
Example
General Syntax
<div class="progress">
<div class="progress-bar" style="width: 20%;"></div>
<div class="progress-bar bg-success" style="width: 30%;"></div>
<div class="progress-bar bg-info" style="width: 40%;"></div>
</div>
Source Code
<div class="container mt-4 mb-4">
<div class="progress">
<div class="progress-bar mt-3" style="width: 20%;"></div>
<div class="progress-bar bg-success mt-3" style="width: 30%;"></div>
<div class="progress-bar bg-info" style="width: 40%;"></div>
</div>
</div><!--container-->
Code Explanation
Note:To create an Inline Progress Bar, assign all the progress bar elements inside the container having class .progress
.
Bootstrap striped progress bar can be created by adding .progress-bar-striped
class to the .progress-bar
.
Example
Source Code
<div class="progress">
<div class="progress-bar progress-bar-striped" style="width: 10%;" ></div>
</div>
To create a Bootstrap 5 animated progress bar, add .progress-bar-striped
class to the .progress-bar
element.
Example
General Syntax
<div class="progress">
<div class="progress-bar progress-bar-striped progress-bar-animated" style="width: 75%;"></div>
</div>
Source Code
<div class="container mt-4">
<h2 class="text-center mt-5 mb-5">Animated Progress Bar</h2>
<div class="progress">
<div class="progress-bar progress-bar-striped progress-bar-animated" style="width: 75%;"></div>
</div> <!--/progress-->
</div><!--container-->
Code Explanation
Note:To create animated stripped progress bar assign .progress-bar-animated
to the element having .progress-bar
class.