使用不同的樣式建立 Bootstrap 進度條


按照以下步驟操作,建立不同樣式的進度條 −

  • 新增一個 class 為 .progress 的 <div>。
  • 接下來,在上面一個 <div> 內,新增一個 class 為 .progress-bar 和 class progress-bar-* 的空 <div>,其中 * 可以是 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>

更新於: 2020 年 6 月 15 日

586 個瀏覽次數

開啟你的 職業生涯

完成課程以獲得認證

開始
廣告
© . All rights reserved.