Create a Bootstrap progress bar with different styles



Follow the below given steps to create a progress bar with different styles −

  • Add a <div> with a class of .progress.
  • Next, inside the above <div>, add an empty <div> with a class of .progress-bar and class progress-bar-* where * could be success, info, warning, danger.
  • Add a style attribute with the width expressed as a percentage. Say, for example, style = "60%"; indicates that the progress bar was at 60%.

The progress bars created below are for showing positive action and key information −

Example

Live Demo

<!DOCTYPE html> <html>    <head>       <title>Bootstrap Example</title>       <link href = "/bootstrap/css/bootstrap.min.css" rel = "stylesheet">       <script src = "/scripts/jquery.min.js"></script>       <script src = "/bootstrap/js/bootstrap.min.js"></script>    </head>    <body>       <h2>Progress Bars</h2>       <div class = "progress">          <div class = "progress-bar progress-bar-success" role = "progressbar"           aria-valuenow = "60" aria-valuemin = "0" aria-valuemax = "100" style = "width: 90%;">             <span class = "sr-only">90% Complete (Sucess)</span>          </div>       </div>       <div class = "progress">          <div class = "progress-bar progress-bar-info" role = "progressbar"          aria-valuenow = "60" aria-valuemin = "0" aria-valuemax = "100" style = "width: 30%;">             <span class = "sr-only">30% Complete (info)</span>          </div>       </div>    </body> </html>
Updated on: 2020-06-15T07:38:35+05:30

688 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements