_list-group.scss 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. // Base class
  2. //
  3. // Easily usable on <ul>, <ol>, or <div>.
  4. .list-group {
  5. // No need to set list-style: none; since .list-group-item is block level
  6. padding-left: 0; // reset padding because ul and ol
  7. margin-bottom: 0;
  8. }
  9. // Individual list items
  10. //
  11. // Use on `li`s or `div`s within the `.list-group` parent.
  12. .list-group-item {
  13. position: relative;
  14. display: block;
  15. padding: .75rem 1.25rem;
  16. // Place the border on the list items and negative margin up for better styling
  17. margin-bottom: -.0625rem;
  18. background-color: $list-group-bg;
  19. border: .0625rem solid $list-group-border;
  20. // Round the first and last items
  21. &:first-child {
  22. @include border-top-radius($list-group-border-radius);
  23. }
  24. &:last-child {
  25. margin-bottom: 0;
  26. @include border-bottom-radius($list-group-border-radius);
  27. }
  28. }
  29. .list-group-flush {
  30. .list-group-item {
  31. border-width: .0625rem 0;
  32. border-radius: 0;
  33. }
  34. }
  35. // Interactive list items
  36. //
  37. // Use anchor or button elements instead of `li`s or `div`s to create interactive
  38. // list items. Includes an extra `.active` modifier class for selected items.
  39. a.list-group-item,
  40. button.list-group-item {
  41. width: 100%;
  42. text-align: inherit;
  43. color: $list-group-link-color;
  44. .list-group-item-heading {
  45. color: $list-group-link-heading-color;
  46. }
  47. // Hover state
  48. @include hover-focus {
  49. color: $list-group-link-hover-color;
  50. text-decoration: none;
  51. background-color: $list-group-hover-bg;
  52. }
  53. }
  54. .list-group-item {
  55. // Disabled state
  56. &.disabled {
  57. @include plain-hover-focus {
  58. color: $list-group-disabled-color;
  59. cursor: $cursor-disabled;
  60. background-color: $list-group-disabled-bg;
  61. // Force color to inherit for custom content
  62. .list-group-item-heading {
  63. color: inherit;
  64. }
  65. .list-group-item-text {
  66. color: $list-group-disabled-text-color;
  67. }
  68. }
  69. }
  70. // Active class on item itself, not parent
  71. &.active {
  72. @include plain-hover-focus {
  73. z-index: 2; // Place active items above their siblings for proper border styling
  74. color: $list-group-active-color;
  75. background-color: $list-group-active-bg;
  76. border-color: $list-group-active-border;
  77. // Force color to inherit for custom content
  78. .list-group-item-heading,
  79. .list-group-item-heading > small,
  80. .list-group-item-heading > .small {
  81. color: inherit;
  82. }
  83. .list-group-item-text {
  84. color: $list-group-active-text-color;
  85. }
  86. }
  87. }
  88. }
  89. // Contextual variants
  90. //
  91. // Add modifier classes to change text and background color on individual items.
  92. // Organizationally, this must come after the `:hover` states.
  93. @include list-group-item-variant(success, $state-success-bg, $state-success-text);
  94. @include list-group-item-variant(info, $state-info-bg, $state-info-text);
  95. @include list-group-item-variant(warning, $state-warning-bg, $state-warning-text);
  96. @include list-group-item-variant(danger, $state-danger-bg, $state-danger-text);
  97. // Custom content options
  98. //
  99. // Extra classes for creating well-formatted content within `.list-group-item`s.
  100. .list-group-item-heading {
  101. margin-top: 0;
  102. margin-bottom: 5px;
  103. }
  104. .list-group-item-text {
  105. margin-bottom: 0;
  106. line-height: 1.3;
  107. }