Bootstrap Badges and Labels

In this chapter we discuss Badges and Labels


Badges are numerical indicators of how many items are associated with a link:

Status 3
Post 7
Photo 9

The numbers (3, 7, and 9) are the badges.

we can use the .badge class within <span> elements to make badges:


<a href="#">Status <span class="badge">3</span></a><br>
<a href="#">Post <span class="badge">7</span></a><br>
<a href="#">Photo <span class="badge">9</span></a>
Try it Yourself »

On the other hand, Badges can also be used inside other elements, such as buttons:

The below example shows how to add badges to buttons:


<button type="button" class="btn btn-primary">Primary <span class="badge">8</span></button>


Labels are used to provide additional information about something:

Example I am

Example I am

Example I am

Example I am

Example I am
Example I am

Use the .label class,  followed by one of the six contextual classes .label-default, .label-primary, .label-success, .label-info, .label-warning or .label-danger, within a <span> element to create a label:


<h1>Example <span class="label label-default">I am</span></h1>
<h2>Example <span class="label label-default">I am</span></h2>
<h3>Example <span class="label label-default">I am</span></h3>
<h4>Example <span class="label label-default">I am</span></h4>
<h5>Example <span class="label label-default">I am</span></h5>
<h6>Example <span class="label label-default">I am</span></h6>
Try it Yourself »

Below code will shows all contextual label classes:

Default Label Primary Label Success Label Info Label Warning Label Danger Label


<span class="label label-default">Default Label</span>
<span class="label label-primary">Primary Label</span>
<span class="label label-success">Success Label</span>
<span class="label label-info">Info Label</span>
<span class="label label-warning">Warning Label</span>
<span class="label label-danger">Danger Label</span>