Create a striped Bootstrap progress bar

BootstrapWeb DevelopmentCSS Framework

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>
raja
Published on 22-Jun-2018 08:18:36
Advertisements