创建不同样式的 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>
广告