Badges
Documentation and examples for badges, our small count and labeling component.
Examples
Badges scale to match the size of the immediate parent element by using relative font sizing and em
units. As of v5, badges no longer have focus or hover styles for links.
Example heading New
Example heading New
Example heading New
Example heading New
Example heading New
Example heading New
<h1>Example heading <span class="badge bg-secondary">New</span></h1>
<h2>Example heading <span class="badge bg-secondary">New</span></h2>
<h3>Example heading <span class="badge bg-secondary">New</span></h3>
<h4>Example heading <span class="badge bg-secondary">New</span></h4>
<h5>Example heading <span class="badge bg-secondary">New</span></h5>
<h6>Example heading <span class="badge bg-secondary">New</span></h6>
Background colors
Use our background utility classes to quickly change the appearance of a badge. Please note that when using Bootstrap’s default .bg-light
, you’ll likely need a text color utility like .text-dark
for proper styling. This is because background utilities do not set anything but background-color
.
<span class="badge bg-primary">Primary</span>
<span class="badge bg-secondary">Secondary</span>
<span class="badge bg-success">Success</span>
<span class="badge bg-danger">Danger</span>
<span class="badge bg-warning text-dark">Warning</span>
<span class="badge bg-info">Info</span>
<span class="badge bg-light text-dark">Light</span>
<span class="badge bg-dark">Dark</span>
Background soft colors
Use our background soft utility classes to quickly change the appearance of a badge. Please note that when using background soft utility classes, you’ll likely need a text color utility like .text-primary
for proper styling. This is because background utilities do not set anything but background-color
.
<a href="#" class="badge bg-primary bg-opacity-10 text-primary">Primary soft</a>
<a href="#" class="badge bg-secondary bg-opacity-10 text-secondary">Secondary soft</a>
<a href="#" class="badge bg-success bg-opacity-10 text-success">Success soft</a>
<a href="#" class="badge bg-danger bg-opacity-10 text-danger">Danger soft</a>
<a href="#" class="badge bg-warning bg-opacity-10 text-warning">Warning soft</a>
<a href="#" class="badge bg-info bg-opacity-10 text-info">Info soft</a>
<a href="#" class="badge bg-dark bg-opacity-10 text-dark">Dark soft</a>
For more information refer official Bootstrap documentation for detailed technical explanation.