Badges
Badges scale to match the size of the immediate parent element by using relative font sizing and em units.
Badges can be used as part of links or buttons to provide a counter.
css class | description |
---|---|
badge | Defines a badge. |
badge-pill | Specifies more rounded badge. |
badge-primary | badge-primary, badge-secondary, ... are removed from v5. Use background classes like bg-primary. |
examples
Primary
Secondary
Success
Danger
Warning
Info
Light
Dark
<span class="badge badge-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">Warning</span>
<span class="badge bg-info">Info</span>
<span class="badge bg-light">Light</span>
<span class="badge bg-dark">Dark</span>
Primary
Secondary
Success
Danger
Warning
Info
Light
Dark
<span class="badge badge-pill badge-primary">Primary</span>
<span class="badge badge-pill badge-secondary">Secondary</span>
<span class="badge badge-pill bg-success">Success</span>
<span class="badge badge-pill bg-danger">Danger</span>
<span class="badge badge-pill bg-warning">Warning</span>
<span class="badge badge-pill bg-info">Info</span>
<span class="badge badge-pill bg-light">Light</span>
<span class="badge badge-pill bg-dark">Dark</span>
<a href="#" class="badge badge-primary">Primary</a>
<a href="#" class="badge bg-secondary">Secondary</a>
<a href="#" class="badge bg-success">Success</a>
<a href="#" class="badge bg-danger">Danger</a>
<a href="#" class="badge bg-warning">Warning</a>
<a href="#" class="badge bg-info">Info</a>
<a href="#" class="badge bg-light">Light</a>
<a href="#" class="badge bg-dark">Dark</a>
<button type="button" class="btn btn-primary">
Profile <span class="badge badge-light">9</span>
<span class="sr-only">unread messages</span>
</button>