创建 Bootstrap 条纹进度条

bootstrapweb developmentcss framework

按照以下步骤在 Bootstrap − 中创建条纹进度条

  • 添加一个 <div> 元素,并为其添加 .progress 和 .progress-striped 类名。
  • 接下来,在上面的 <div> 元素内,添加一个空的 <div> 元素,并为其添加 .progress-bar 和 progress-bar-* 类名,其中 * 可以是 success、info、warning 和 danger。
  • 添加一个样式属性,其宽度以百分比表示。例如,style = "60%"; 表示进度条已到达 60%。

您可以尝试运行以下代码来创建条纹进度条 −

示例

<!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>

相关文章