_list-group.less 2.95 KB
Newer Older
Mark Otto's avatar
Mark Otto committed
1
2
3
4
//
// List groups
// --------------------------------------------------

Mark Otto's avatar
Mark Otto committed
5

Mark Otto's avatar
Mark Otto committed
6
7
8
// Base class
//
// Easily usable on <ul>, <ol>, or <div>.
Mark Otto's avatar
Mark Otto committed
9

Mark Otto's avatar
Mark Otto committed
10
11
.list-group {
  // No need to set list-style: none; since .list-group-item is block level
12
13
  margin-bottom: 20px;
  padding-left: 0; // reset padding because ul and ol
Mark Otto's avatar
Mark Otto committed
14
15
}

Mark Otto's avatar
Mark Otto committed
16

Mark Otto's avatar
Mark Otto committed
17
// Individual list items
Mark Otto's avatar
Mark Otto committed
18
19
//
// Use on `li`s or `div`s within the `.list-group` parent.
Mark Otto's avatar
Mark Otto committed
20
21
22
23

.list-group-item {
  position: relative;
  display: block;
24
  padding: 10px 15px;
Mark Otto's avatar
Mark Otto committed
25
26
  // Place the border on the list items and negative margin up for better styling
  margin-bottom: -1px;
27
  background-color: @list-group-bg;
Mark Otto's avatar
Mark Otto committed
28
29
  border: 1px solid @list-group-border;

30
31
  // Round the first and last items
  &:first-child {
32
    .border-top-radius(@list-group-border-radius);
33
34
35
  }
  &:last-child {
    margin-bottom: 0;
36
    .border-bottom-radius(@list-group-border-radius);
37
  }
38
}
Mark Otto's avatar
Mark Otto committed
39

40

41
// Linked list items
Mark Otto's avatar
Mark Otto committed
42
43
44
45
//
// Use anchor elements instead of `li`s or `div`s to create linked list items.
// Includes an extra `.active` modifier class for showing selected items.

46
47
a.list-group-item {
  color: @list-group-link-color;
48

49
50
51
  .list-group-item-heading {
    color: @list-group-link-heading-color;
  }
Mark Otto's avatar
Mark Otto committed
52

53
54
55
56
  // Hover state
  &:hover,
  &:focus {
    text-decoration: none;
57
    color: @list-group-link-hover-color;
58
    background-color: @list-group-hover-bg;
59
  }
60
}
Mark Otto's avatar
Mark Otto committed
61

62
.list-group-item {
63
64
65
66
67
68
  // Disabled state
  &.disabled,
  &.disabled:hover,
  &.disabled:focus {
    background-color: @list-group-disabled-bg;
    color: @list-group-disabled-color;
69
    cursor: @cursor-disabled;
vsn4ik's avatar
vsn4ik committed
70

71
72
73
74
75
76
77
78
    // Force color to inherit for custom content
    .list-group-item-heading {
      color: inherit;
    }
    .list-group-item-text {
      color: @list-group-disabled-text-color;
    }
  }
Mark Otto's avatar
Mark Otto committed
79

80
  // Active class on item itself, not parent
81
82
83
  &.active,
  &.active:hover,
  &.active:focus {
84
85
86
87
    z-index: 2; // Place active items above their siblings for proper border styling
    color: @list-group-active-color;
    background-color: @list-group-active-bg;
    border-color: @list-group-active-border;
Mark Otto's avatar
Mark Otto committed
88

89
    // Force color to inherit for custom content
90
91
92
    .list-group-item-heading,
    .list-group-item-heading > small,
    .list-group-item-heading > .small {
93
94
95
      color: inherit;
    }
    .list-group-item-text {
Mark Otto's avatar
Mark Otto committed
96
      color: @list-group-active-text-color;
97
98
    }
  }
Mark Otto's avatar
Mark Otto committed
99
}
100

Mark Otto's avatar
Mark Otto committed
101
102
103
104
105
106
107

// Contextual variants
//
// Add modifier classes to change text and background color on individual items.
// Organizationally, this must come after the `:hover` states.

.list-group-item-variant(success; @state-success-bg; @state-success-text);
108
.list-group-item-variant(info; @state-info-bg; @state-info-text);
Mark Otto's avatar
Mark Otto committed
109
110
111
112
.list-group-item-variant(warning; @state-warning-bg; @state-warning-text);
.list-group-item-variant(danger; @state-danger-bg; @state-danger-text);


113
// Custom content options
Mark Otto's avatar
Mark Otto committed
114
115
//
// Extra classes for creating well-formatted content within `.list-group-item`s.
116
117
118
119
120
121
122
123
124

.list-group-item-heading {
  margin-top: 0;
  margin-bottom: 5px;
}
.list-group-item-text {
  margin-bottom: 0;
  line-height: 1.3;
}