Bs5 Progress Bars in Bootstrap
Sure! Here’s a quick guide on Bootstrap 5 Progress Bars — great for showing task progress visually.
? Bootstrap 5 Progress Bars
Progress bars provide feedback on task progress with horizontal bars.
1. Basic Progress Bar
<div class="progress"> <div class="progress-bar" role="progressbar" style="width: 50%;" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100"> 50% </div></div>.progressis the container..progress-barshows the filled portion.style="width: 50%;"sets the progress visually.ARIA attributes improve accessibility.
2. Colored Progress Bars
Use contextual classes to change color:
.bg-success(green).bg-info(blue).bg-warning(yellow).bg-danger(red).bg-primary(default blue).bg-secondary,.bg-dark,.bg-light
Example:
<div class="progress"> <div class="progress-bar bg-success" style="width: 75%;">75%</div></div>3. Striped Progress Bars
Add .progress-bar-striped for stripes:
<div class="progress"> <div class="progress-bar progress-bar-striped" style="width: 40%;">40%</div></div>4. Animated Stripes
Add .progress-bar-animated to animate stripes:
<div class="progress"> <div class="progress-bar progress-bar-striped progress-bar-animated" style="width: 60%;">60%</div></div>5. Multiple Bars (Stacked)
You can stack multiple bars in one progress container:
<div class="progress"> <div class="progress-bar bg-success" style="width: 35%"></div> <div class="progress-bar bg-warning" style="width: 20%"></div> <div class="progress-bar bg-danger" style="width: 10%"></div></div>6. Height Customization
Set height on the .progress container:
<div class="progress" style="height: 1.5rem;"> <div class="progress-bar" style="width: 50%;">50%</div></div>Summary Table
| Class | Description |
|---|---|
.progress | Container for progress bar |
.progress-bar | Actual progress bar |
.bg-success / .bg-info | Color variants |
.progress-bar-striped | Adds stripes |
.progress-bar-animated | Animates stripes |
If you want, I can help you create dynamic progress bars or customize them with labels and tooltips!