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.
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-success
bg- info
bg-light
bg-dark
bg-danger
bg-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.
To create a progress bar with label or text, the following code is used:
Line 18: We generate a simple progress bar with aria-valuenow=
value= 40
.
To use different colors in the progress bar, we use contextual classes in code. The following is an example:
progress-bar-success
subclass.progress-bar-info
subclass.progress-bar-warning
subclass.progress-bar-danger
subclass.To create animated striped progress bars, add .progress-bar-animated
or .progress-bar-animated
. An example of an animated striped bar is as follows:
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.