list-group.less 2.56 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
39
40
41
42
  }

  // Align badges within list items
  > .badge {
    float: right;
  }
43
  > .badge + .badge {
44
    margin-right: 5px;
45
  }
46
}
Mark Otto's avatar
Mark Otto committed
47

48

49
// Linked list items
Mark Otto's avatar
Mark Otto committed
50
51
52
53
//
// 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.

54
55
a.list-group-item {
  color: @list-group-link-color;
56

57
58
59
  .list-group-item-heading {
    color: @list-group-link-heading-color;
  }
Mark Otto's avatar
Mark Otto committed
60

61
62
63
64
65
  // Hover state
  &:hover,
  &:focus {
    text-decoration: none;
    background-color: @list-group-hover-bg;
66
  }
Mark Otto's avatar
Mark Otto committed
67

68
  // Active class on item itself, not parent
69
70
71
  &.active,
  &.active:hover,
  &.active:focus {
72
73
74
75
    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
76

77
78
79
80
81
    // Force color to inherit for custom content
    .list-group-item-heading {
      color: inherit;
    }
    .list-group-item-text {
Mark Otto's avatar
Mark Otto committed
82
      color: @list-group-active-text-color;
83
84
    }
  }
Mark Otto's avatar
Mark Otto committed
85
}
86

Mark Otto's avatar
Mark Otto committed
87
88
89
90
91
92
93

// 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);
94
.list-group-item-variant(info; @state-info-bg; @state-info-text);
Mark Otto's avatar
Mark Otto committed
95
96
97
98
.list-group-item-variant(warning; @state-warning-bg; @state-warning-text);
.list-group-item-variant(danger; @state-danger-bg; @state-danger-text);


99
// Custom content options
Mark Otto's avatar
Mark Otto committed
100
101
//
// Extra classes for creating well-formatted content within `.list-group-item`s.
102
103
104
105
106
107
108
109
110

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