如何用自定义颜色更改引导进度条的颜色 [英] How can I change color of bootstrap progress bar with custom color

查看:379
本文介绍了如何用自定义颜色更改引导进度条的颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在不丢失文字的情况下更改引导进度栏的颜色?
我已经看到这个答案;

How can I change the color of bootstrap progress bar without losing text? I have seen this answer;

$('#pb').css({
    'background-image': 'none',
    'background-color': 'red'
});

这里

它可以工作,

推荐答案

p>使用Bootstrap 3.2.0,你可以做如下:

Using Bootstrap 3.2.0, you can do something like the following:

$(function() { 
   $("#one").addClass("progress-bar-purple");
   $("#two").addClass("progress-bar-orange");
});

.progress-bar-purple {
      background-color: purple !important;
}
.progress-bar-orange {
      background-color: orange !important;
}

<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<br/>
<div class="progress">
  <div id="one" class="progress-bar" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 60%;">
    60%
  </div>
</div>
<div class="progress">
  <div id="two" class="progress-bar progress-bar-striped" role="progressbar" aria-valuenow="80" aria-valuemin="0" aria-valuemax="100" style="width: 80%;">
    80%
  </div>
</div>

这篇关于如何用自定义颜色更改引导进度条的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆