创建具有不同样式的 Bootstrap 进度条

bootstrapweb developmentcss framework

按照以下步骤创建具有不同样式的进度条 −

  • 添加一个带有 .progress 类名的 <div>。
  • 接下来,在上面的 <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>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>

相关文章