Bootstrap 4徽章没有改变颜色

时间:2017-06-30 05:15:35

标签: twitter-bootstrap bootstrap-4

我正在使用bootstrap 4,我想创建一个蓝色徽章,所以我使用了:

.join()

<td><a href="patient_history.php?pid=<?php echo $patient['patient_id']; ?>"><i class="badge badge-info">Edit History</i></a></td> 的表格中,结果是默认徽章颜色,而不是蓝色。

enter image description here

4 个答案:

答案 0 :(得分:5)

改为使用.label-pill

<span class="label label-pill label-primary">Primary</span>

复制css中的以下行并再试一次

.label-as-badge {
    border-radius: 1em;
}

您的问题似乎已经有了答案,请尝试以下链接:

how to use .label-pill class in Bootstrap-4

答案 1 :(得分:1)

尝试创建自定义类。

HTML代码

<span class="badge">1</span>
<span class="badge badge-success">2</span>
<span class="badge badge-warning">4</span>
<span class="badge badge-error">6</span>
<span class="badge badge-info">8</span>
<span class="badge badge-inverse">10</span>

CSS代码

.badge {
  padding: 1px 9px 2px;
  font-size: 12.025px;
  font-weight: bold;
  white-space: nowrap;
  color: #ffffff;
  background-color: #999999;
  -webkit-border-radius: 9px;
  -moz-border-radius: 9px;
  border-radius: 9px;
}
.badge:hover {
  color: #ffffff;
  text-decoration: none;
  cursor: pointer;
}
.badge-error {
  background-color: #b94a48;
}
.badge-error:hover {
  background-color: #953b39;
}
.badge-warning {
  background-color: #f89406;
}
.badge-warning:hover {
  background-color: #c67605;
}
.badge-success {
  background-color: #468847;
}
.badge-success:hover {
  background-color: #356635;
}
.badge-info {
  background-color: #3a87ad;
}
.badge-info:hover {
  background-color: #2d6987;
}
.badge-inverse {
  background-color: #333333;
}
.badge-inverse:hover {
  background-color: #1a1a1a;
}

答案 2 :(得分:1)

使用它

使用.label类,然后在.label-default, .label-primary, .label-success, .label-info, .label-warning元素中的六个上下文类.label-danger<span>中的一个来创建标签

 <span class="label label-default">Edit History</span>

答案 3 :(得分:1)

使用进度条代替徽章。例如:

<i class="badge progress-bar-info">Edit History</i>

<span class="badge progress-bar-success">Active</span>
<span class="badge progress-bar-danger">Inactive</span>