Bootstrap 3进度条百分比将显示在其下方(Bootstrap 3 progress bar percentages to be displayed under it)

编程入门 行业动态 更新时间:2024-10-24 19:21:39
Bootstrap 3进度条百分比将显示在其下方(Bootstrap 3 progress bar percentages to be displayed under it)

这是默认的bootstrap堆叠进度条。 我希望能够在白色空间中显示进度条下的百分比而不是它。

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<div class="progress">
                  <div class="progress-bar progress-bar-danger" role="progressbar" style="width:13%">13%</div>
                  <div class="progress-bar progress-bar-warning" role="progressbar" style="width:7%">7%</div>
                  <div class="progress-bar progress-bar-success" role="progressbar" style="width:80%">80%</div>
                </div> 
  
 

谢谢您的帮助。

This is the default bootstrap stacked progress bar. I would like to be able to show the percentages under the progress bar in white space instead of on it.

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<div class="progress">
                  <div class="progress-bar progress-bar-danger" role="progressbar" style="width:13%">13%</div>
                  <div class="progress-bar progress-bar-warning" role="progressbar" style="width:7%">7%</div>
                  <div class="progress-bar progress-bar-success" role="progressbar" style="width:80%">80%</div>
                </div> 
  
 

Thanks for the help.

最满意答案

简单地把它放在新的div中,添加一些样式,你就完成了。 例:

.progress-desc {
  margin-top: -1.5em;
}
.progress-desc div {
  display: block;
  float: left;
  text-align: center;
} 
  
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<div class="progress">
  <div class="progress-bar progress-bar-danger" role="progressbar" style="width:13%"></div>
  <div class="progress-bar progress-bar-warning" role="progressbar" style="width:7%"></div>
  <div class="progress-bar progress-bar-success" role="progressbar" style="width:80%"></div>
</div>
<div class="progress-desc">
  <div style="width:13%">13%</div>
  <div style="width:7%">7%</div>
  <div style="width:80%">80%</div>
</div> 
  
 

Simply put it in new div, add some styling and you're done. example:

.progress-desc {
  margin-top: -1.5em;
}
.progress-desc div {
  display: block;
  float: left;
  text-align: center;
} 
  
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<div class="progress">
  <div class="progress-bar progress-bar-danger" role="progressbar" style="width:13%"></div>
  <div class="progress-bar progress-bar-warning" role="progressbar" style="width:7%"></div>
  <div class="progress-bar progress-bar-success" role="progressbar" style="width:80%"></div>
</div>
<div class="progress-desc">
  <div style="width:13%">13%</div>
  <div style="width:7%">7%</div>
  <div style="width:80%">80%</div>
</div> 
  
 

更多推荐

本文发布于:2023-08-06 13:54:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1451172.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:百分比   进度条   Bootstrap   progress   displayed

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!