肉渣教程

进度条

上一节 下一节

Bootstrap的进度条组件是非常实用的,该组件是基于CSS3中的transition和animation属性而构建的。因此对于IE9或更低版本的IE等太古老的浏览器是不兼容的。不兼容就不兼容,不用管,谁叫这个用户还用这么古老的浏览器,呵呵...


最简单的进度条

60% Complete
<div class="progress">
  <div class="progress-bar" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 60%;">
    <span class="sr-only">60% Complete</span>
  </div>
</div>

运行一下

带提示文字的进度条

60%
<div class="progress">
  <div class="progress-bar" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 60%;">
    60%
  </div>
</div>

运行一下

设置min-width属性以显示较低百分比

0%
3%
<div class="progress">
  <div class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="min-width: 2em;">
    0%
  </div>
</div>
<div class="progress">
  <div class="progress-bar" role="progressbar" aria-valuenow="3" aria-valuemin="0" aria-valuemax="100" style="min-width: 2em; width: 3%;">
    3%
  </div>
</div>

运行一下

情景化的进度条

40% Complete (success)
20% Complete
60% Complete (warning)
80% Complete (danger)

运行一下

条纹效果的进度条

40% Complete (success)
20% Complete
60% Complete (warning)
80% Complete (danger)

运行一下

动画效果的进度条

45% Complete
<div class="progress">
  <div class="progress-bar progress-bar-striped active" role="progressbar" aria-valuenow="45" aria-valuemin="0" aria-valuemax="100" style="width: 45%">
    <span class="sr-only">45% Complete</span>
  </div>
</div>

运行一下

堆叠效果的进度条

35% Complete (success)
20% Complete (warning)
10% Complete (danger)
<div class="progress">
  <div class="progress-bar progress-bar-success" style="width: 35%">
    <span class="sr-only">35% Complete (success)</span>
  </div>
  <div class="progress-bar progress-bar-warning progress-bar-striped" style="width: 20%">
    <span class="sr-only">20% Complete (warning)</span>
  </div>
  <div class="progress-bar progress-bar-danger" style="width: 10%">
    <span class="sr-only">10% Complete (danger)</span>
  </div>
</div>

运行一下


进度条

上一节 下一节