badges.less 1.65 KB
Newer Older
1
2
3
4
//
// Labels and badges
// --------------------------------------------------

5
6
7

// Base classes
.badge {
8
9
  display: inline-block;
  padding: 2px 4px;
10
  font-size: @font-size-base * .846;
11
  font-weight: bold;
Mark Otto's avatar
Mark Otto committed
12
  line-height: 14px; // ensure proper line-height if floated
13
  color: #fff;
14
  vertical-align: baseline;
15
16
17
  white-space: nowrap;
  text-shadow: 0 -1px 0 rgba(0,0,0,.25);
  background-color: @grayLight;
18
  border-radius: 3px;
19

20
  // Empty labels/badges collapse
21
22
23
24
25
  &:empty {
    display: none;
  }
}

26
// Hover state, but only for links
27
28
a.badge {
  &:hover {
29
    color: #fff;
30
31
32
33
34
35
36
37
38
    text-decoration: none;
    cursor: pointer;
  }
}

// Colors
// Only give background-color difference to links (and to simplify, we don't qualifty with `a` but [href] attribute)
.badge {
  // Important (red)
Mark Otto's avatar
Mark Otto committed
39
40
  &-danger            { background-color: @state-error-text; }
  &-danger[href]      { background-color: darken(@state-error-text, 10%); }
41
  // Warnings (orange)
42
43
  &-warning           { background-color: #f89406; }
  &-warning[href]     { background-color: darken(#f89406, 10%); }
44
  // Success (green)
Mark Otto's avatar
Mark Otto committed
45
46
  &-success           { background-color: @state-success-text; }
  &-success[href]     { background-color: darken(@state-success-text, 10%); }
47
  // Info (turquoise)
Mark Otto's avatar
Mark Otto committed
48
49
  &-info              { background-color: @state-info-text; }
  &-info[href]        { background-color: darken(@state-info-text, 10%); }
50
51
52
53
  // Inverse (black)
  &-inverse           { background-color: @grayDark; }
  &-inverse[href]     { background-color: darken(@grayDark, 10%); }
}
54
55
56
57
58
59
60
61

// Quick fix for labels/badges in buttons
.btn {
  .badge {
    position: relative;
    top: -1px;
  }
}
62
63
64
65
66
.btn-mini {
  .badge {
    top: 0;
  }
}