07 Oct Bootstrap Progress Bars
Learn how to create a ProgressBar on a web page with Bootstrap. With that, get a thorough understanding of the following in this lesson:
- Set the width of ProgressBar
- Set the height of ProgressBar
- Add stripes to ProgressBar
- Change the color of ProgressBar
- Animate ProgressBar
To create a Progress Bar, use the Bootstrap classes .progress and .progress-bar classes. With that, we can use the Bootstrap classes to work on Progress Bars:
- Set the width of a Progress Bar with the width property.
- Set the height of a Progress Bar with the height property.
- To add stripes to a Progress Bar, use the .progress-bar-striped class
Use the Bootstrap contextual background classes to change the color of the Progress Bar:
- .progress-bar-success
- .progress-bar-info
- .progress-bar-warning
- .progress-bar-danger
To animate a Progress Bar, use the .progress-bar-animated class.
Example – Bootstrap Progress Bars
Let us now see an example to create Progress Bars in Bootstrap:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
<!DOCTYPE html> <html lang="en"> <head> <title>Bootstrap Progress Bars Example</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css" rel="stylesheet"> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script> </head> <body> <div class="container"> <h2>Level of Water in the Cave</h2> <div class="progress" style="height: 25px;"> <div class="progress-bar" style="width:90%;height: 25px;"> </div> </div> </div> </body> </html> |
Output
Video Tutorial – Bootstrap Progress Bars
The following is the complete video tutorial to learn how to work with Progress Bars in Bootstrap:
If you liked the tutorial, spread the word and share the link and our website Studyopedia with others:
Read More:
No Comments