Menu
×
   ❮   
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS R TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI GO KOTLIN SASS VUE DSA GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE
     ❯   

Bootstrap 5 进度条


基础进度条

进度条可以用来显示用户在某个流程中的进度。

要创建默认的进度条,请将 .progress 类添加到容器元素,并将 .progress-bar 类添加到其子元素。使用 CSS width 属性设置进度条的宽度

示例

<div class="progress">
  <div class="progress-bar" style="width:70%"></div>
</div>
亲自试一试 »

进度条高度




进度条的高度默认情况下为 1rem(通常为 16px)。使用 CSS height 属性来更改它

示例

<div class="progress" style="height:20px">
  <div class="progress-bar" style="width:40%;"></div>
</div>
亲自试一试 »

进度条标签

在进度条内添加文本以显示可见的百分比

70%

示例

<div class="progress">
  <div class="progress-bar" style="width:70%">70%</div>
</div>
亲自试一试 »


彩色进度条










默认情况下,进度条为蓝色(主要)。使用任何上下文背景类来更改其颜色

示例

<!-- 蓝色 -->
<div class="progress">
  <div class="progress-bar" style="width:10%"></div>
</div>

<!-- 绿色 -->
<div class="progress">
  <div class="progress-bar bg-success" style="width:20%"></div>
</div>

<!-- 青色 -->
<div class="progress">
  <div class="progress-bar bg-info" style="width:30%"></div>
</div>

<!-- 橙色 -->
<div class="progress">
   <div class="progress-bar bg-warning" style="width:40%"></div>
</div>

<!-- 红色 -->
<div class="progress">
  <div class="progress-bar bg-danger" style="width:50%"></div>
</div>

<!-- 白色 -->
<div class="progress border">
  <div class="progress-bar bg-white" style="width:60%"></div>
</div>

<!-- 灰色 -->
<div class="progress">
  <div class="progress-bar bg-secondary" style="width:70%"></div>
</div>

<!-- 浅灰色 -->
<div class="progress border">
  <div class="progress-bar bg-light" style="width:80%"></div>
</div>

<!-- 深灰色 -->
<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%">
    空闲空间
  </div>
  <div class="progress-bar bg-warning" style="width:10%">
    警告
  </div>
  <div class="progress-bar bg-danger" style="width:20%">
    危险
  </div>
</div>
亲自试一试 »

×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
[email protected]

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
[email protected]

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.

Copyright 1999-2024 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.