I am using bootstrap 4 and I want to create a badge with blue color so I used:
<td><a href="patient_history.php?pid=<?php echo $patient['patient_id']; ?>"><i class="badge badge-info">Edit History</i></a></td>
inside a table of class="table table-hover"
, and the result was the default badge color and not blue.
Color shading Create custom badge with custom background color by using bg-{darken|lighten}-* shading class, . bg-alpha-* to change the background alpha channel and . text-{color} to set the font color.
To use badges just add <span class = "badge"> to links, Bootstrap navs, and more. When there are no new or unread items, badges will simply collapse via CSS's :empty selector, provided no content exists within.
Use the . badge-pill modifier class to make badges more rounded (with a larger border-radius and additional horizontal padding ).
use .label-pill
instead.
<span class="label label-pill label-primary">Primary</span>
copy the following line in your css and try again
.label-as-badge {
border-radius: 1em;
}
Your question already seems to have an answer, Try the below link :
how to use .label-pill class in Bootstrap-4
Use progress-bar instead of badge. For example :
<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>
Try with creating custom classes.
.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;
}
<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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With