进度条可用于向用户显示他/她在进程中进行了多远。
要创建默认进度条,请添加.progress
类到容器元素并添加.progress-bar
类到它的子元素。使用CSSwidth
属性设置进度条的宽度:
进度条的高度默认为16px。使用CSSheight
属性来改变它。请注意,必须为进度容器和进度条设置相同的高度:
<div class="progress" style="height:20px">
<div class="progress-bar" style="width:40%;height:20px"></div>
</div>
亲自试一试 »
在进度条内添加文本以显示可见百分比:
默认情况下,进度条为蓝色(主要)。使用任何 Bootstrap 4 上下文背景类来更改其颜色:
<!-- Blue -->
<div class="progress">
<div class="progress-bar" style="width:10%"></div>
</div>
<!-- Green -->
<div class="progress">
<div class="progress-bar bg-success" style="width:20%"></div>
</div>
<!-- Turquoise -->
<div class="progress">
<div class="progress-bar bg-info" style="width:30%"></div>
</div>
<!-- Orange -->
<div class="progress">
<div class="progress-bar bg-warning" style="width:40%"></div>
</div>
<!-- Red -->
<div class="progress">
<div class="progress-bar bg-danger" style="width:50%"></div>
</div>
<!-- White -->
<div class="progress border">
<div class="progress-bar bg-white" style="width:60%"></div>
</div>
<!-- Grey -->
<div class="progress">
<div class="progress-bar bg-secondary" style="width:70%"></div>
</div>
<!-- Light Grey -->
<div class="progress border">
<div class="progress-bar bg-light" style="width:80%"></div>
</div>
<!-- Dark Grey -->
<div class="progress">
<div class="progress-bar bg-dark" style="width:90%"></div>
</div>
亲自试一试 »
使用.progress-bar-striped
向进度条添加条纹的类:
<div class="progress">
<div class="progress-bar progress-bar-striped" style="width:40%"></div>
</div>
亲自试一试 »
添加.progress-bar-animated
类来动画进度条:
<div class="progress-bar progress-bar-striped progress-bar-animated" style="width:40%"></div>
亲自试一试 »
进度条也可以堆叠:
<div class="progress">
<div class="progress-bar bg-success" style="width:40%">
Free Space
</div>
<div class="progress-bar bg-warning" style="width:10%">
Warning
</div>
<div class="progress-bar bg-danger" style="width:20%">
Danger
</div>
</div>
亲自试一试 »
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!