Create a striped Bootstrap progress bar


Follow the below given steps to create a striped progress bar in Bootstrap −

  • Add a <div> with a class of .progress and .progress-striped.
  • 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%.

You can try to run the following code to form a striped progress bar −

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>Striped Progress Bars</h2>
      <h3>Warning Progress Bar</h3>
      <div class = "progress progress-striped">
         <div class = "progress-bar progress-bar-warning" role = "progressbar"
         aria-valuenow = "45" aria-valuemin = "0" aria-valuemax = "100" style="width: 45%;">
            <span class = "sr-only">45%Complete (warning)</span>
         </div>
      </div>
      <h3>Danger Progress Bar</h3>
      <div class = "progress progress-striped">
         <div class = "progress-bar progress-bar-danger" role = "progressbar"
            aria-valuenow = "80" aria-valuemin = "0" aria-valuemax = "100" style = "width: 80%;">
            <span class = "sr-only">80% Complete (danger)</span>
         </div>
      </div>
   </body>
</html>

Updated on: 12-Jun-2020

387 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements