badges.html 2.46 KB
Newer Older
Mark Otto's avatar
Mark Otto committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<div class="bs-docs-section">
  <h1 id="badges" class="page-header">Badges</h1>

  <p class="lead">Easily highlight new or unread items by adding a <code>&lt;span class="badge"&gt;</code> to links, Bootstrap navs, and more.</p>

  <div class="bs-example">
    <a href="#">Inbox <span class="badge">42</span></a>
  </div>
{% highlight html %}
<a href="#">Inbox <span class="badge">42</span></a>
{% endhighlight %}

  <h4>Self collapsing</h4>
  <p>When there are no new or unread items, badges will simply collapse (via CSS's <code>:empty</code> selector) provided no content exists within.</p>

  <div class="bs-callout bs-callout-danger">
    <h4>Cross-browser compatibility</h4>
    <p>Badges won't self collapse in Internet Explorer 8 because it lacks support for the <code>:empty</code> selector.</p>
  </div>

  <h4>Adapts to active nav states</h4>
  <p>Built-in styles are included for placing badges in active states in pill navigations.</p>
  <div class="bs-example">
24
    <ul class="nav nav-pills" role="tablist">
25
26
27
      <li role="presentation" class="active"><a href="#">Home <span class="badge">42</span></a></li>
      <li role="presentation"><a href="#">Profile</a></li>
      <li role="presentation"><a href="#">Messages <span class="badge">3</span></a></li>
Mark Otto's avatar
Mark Otto committed
28
29
    </ul>
    <br>
30
    <ul class="nav nav-pills nav-stacked" role="tablist" style="max-width: 260px;">
31
      <li role="presentation" class="active">
Mark Otto's avatar
Mark Otto committed
32
33
34
35
36
        <a href="#">
          <span class="badge pull-right">42</span>
          Home
        </a>
      </li>
37
38
      <li role="presentation"><a href="#">Profile</a></li>
      <li role="presentation">
Mark Otto's avatar
Mark Otto committed
39
40
41
42
43
44
45
        <a href="#">
          <span class="badge pull-right">3</span>
          Messages
        </a>
      </li>
    </ul>
    <br>
Mark Otto's avatar
Mark Otto committed
46
47
48
49
50
51
52
53
54
55
56
57
58
59
    <p>
      <button class="btn btn-primary btn-lg" type="button">
        Large button <span class="badge">4</span>
      </button>
      <button class="btn btn-primary" type="button">
        Button <span class="badge">4</span>
      </button>
      <button class="btn btn-primary btn-sm" type="button">
        Small button <span class="badge">4</span>
      </button>
      <button class="btn btn-primary btn-xs" type="button">
        Extra small <span class="badge">4</span>
      </button>
    </p>
Mark Otto's avatar
Mark Otto committed
60
61
  </div>
{% highlight html %}
62
<ul class="nav nav-pills nav-stacked" role="tablist">
63
  <li role="presentation" class="active">
Mark Otto's avatar
Mark Otto committed
64
65
66
67
68
69
70
71
72
    <a href="#">
      <span class="badge pull-right">42</span>
      Home
    </a>
  </li>
  ...
</ul>
{% endhighlight %}
</div>