Bootstrap progress bars point progress of the current action/task.
Steps: to create proress bar:
.progress
to the container.
.progress-bar
to the child element of the container.
width
of the progress bar, you have to use the CSS width
property.
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="progress">
<div class="progress-bar" role="progressbar" style="width: 25%" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
</div>
Try it yourself
Source Code : Output
To create progress bar label,place text inside .progress-bar
.
General Syntax
<div class="progress">
<div class="progress-bar" style="width: 60%"> 60%</div>
</div>
Source Code
<div class="progress">
<div class="progress-bar" style="width: 60%;">60%</div>
</div>
Try it yourself
Source Code : Output
Note:To create a progress bar label, assign text information inside the element having .progress-bar
class.
The default height of the progress bar is 16px.It can also be changed by assigning CSS height property to the
.progress
element.
General Syntax
<!-- Progress bar with 20px height -->
<div class="progress" style="height: 25px;">
<div class="progress-bar" style="width: 50%;">height:25px</div>
</div>
Source Code
<!-- Progress bar with 1px height -->
<div class="progress mb-2" style="height: 22px;">
<div class="progress-bar" style="width: 50%;">height:22px</div>
</div>
<!-- Progress bar with 20px height -->
<div class="progress" style="height: 25px;">
<div class="progress-bar" style="width: 50%;">height:25px</div>
</div>
Try it yourself
Source Code : Output
Note: Progress bar height can be changed by providing CSS height property to the element having .progress
.
Bootsrap progress bar background color can be set using background utility classes.
General Syntax
<div class="progress mb-2">
<div class="progress-bar bg-success" style="width: 25%"></div>
</div>
Source Code
<div class="progress mb-2">
<div class="progress-bar bg-success" style="width: 25%" ></div>
</div>
Try it yourself
Source Code : Output
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.
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="progress">
<div class="progress-bar" role="progressbar" 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>
Try it yourself
Source Code : Output
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 easily by adding .progress-bar-striped
class to the .progress-bar
.
General Syntax
<div class="progress">
<div class="progress-bar progress-bar-striped" style="width: 10%;"></div>
</div>
Source Code
<div class="progress">
<div class="progress-bar progress-bar-striped" style="width: 10%;"></div>
</div>
Try it yourself
Source Code : Output
Note:
To create striped progress bar assign .progress-bar-striped
to the element having .progress-bar
class.
Add .progress-bar-striped
to the .progress-bar
element to create an animated progress bar.
General Syntax
<div class="progress">
<div class="progress-bar progress-bar-striped progress-bar-animated" style="width: 75%;"></div>
</div>
Source Code
<div class="progress">
<div class="progress-bar progress-bar-striped progress-bar-animated" style="width: 75%;"></div>
</div>
Try it yourself
Source Code : Output
Note:To create animated stripped progress bar assign .progress-bar-animated
to the element having .progress-bar
class.