What is the progress bar in bootstrap 4?
Progress Bar
A progress bar is a visual representation to show the progress of a task or an operation. Progress bar plays a vital role in many web applications to show the progress of action to users. Bootstrap offers different progress bars, depending upon multiple parameters like color, height, shape, or style.
How to create a progress bar in bootstrap 4
To create a progress bar in bootstrap, we use the .progress as a wrapper class in the container. To set the length and width of the progress bar, we use the attributes of the aria value.
To create progress bars with different colors and styles, we use utility classes, also known as contextual classes, in the background. These utility classes are:
bg-successbg- infobg-light
bg-darkbg-dangerbg-warning
To create an animated striped progress bar, we use .progress-bar-animated.
Note: Internet Explorer 9 and earlier does not support the animated progress bar because IE uses CSS3 transitions and animations to achieve some of their effects.
Progress bar with a label
To create a progress bar with label or text, the following code is used:
Explanation
Line 18: We generate a simple progress bar with aria-valuenow= value= 40.
Progress bar with colors
To use different colors in the progress bar, we use contextual classes in code. The following is an example:
Explanation
- Line 15: We have a success progress bar in green color using the
progress-bar-successsubclass. - Line 24: We have an information progress bar in blue color using the
progress-bar-infosubclass. - Line 33: We have a yellow progress bar using the
progress-bar-warningsubclass. - Line 42: We have a red progress bar using the
progress-bar-dangersubclass.
Animated striped progress bar
To create animated striped progress bars, add .progress-bar-animated or .progress-bar-animated. An example of an animated striped bar is as follows:
Explanation
As highlighted above, we generate stripped progress bars in Gray, Blue, Red, and dull green color. The stripped bars inherit from the .progress-bar class in the code widget.