_list-group.scss 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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: $list-group-item-padding-y $list-group-item-padding-x;
  16. // Place the border on the list items and negative margin up for better styling
  17. margin-bottom: -$list-group-border-width;
  18. background-color: $list-group-bg;
  19. border: $list-group-border-width solid $list-group-border-color;
  20. &:first-child {
  21. @include border-top-radius($list-group-border-radius);
  22. }
  23. &:last-child {
  24. margin-bottom: 0;
  25. @include border-bottom-radius($list-group-border-radius);
  26. }
  27. &.disabled {
  28. @include plain-hover-focus {
  29. color: $list-group-disabled-color;
  30. cursor: $cursor-disabled;
  31. background-color: $list-group-disabled-bg;
  32. // Force color to inherit for custom content
  33. .list-group-item-heading {
  34. color: inherit;
  35. }
  36. .list-group-item-text {
  37. color: $list-group-disabled-text-color;
  38. }
  39. }
  40. }
  41. &.active {
  42. @include plain-hover-focus {
  43. z-index: 2; // Place active items above their siblings for proper border styling
  44. color: $list-group-active-color;
  45. text-decoration: none; // Repeat here because it inherits global a:hover otherwise
  46. background-color: $list-group-active-bg;
  47. border-color: $list-group-active-border;
  48. // Force color to inherit for custom content
  49. .list-group-item-heading,
  50. .list-group-item-heading > small,
  51. .list-group-item-heading > .small {
  52. color: inherit;
  53. }
  54. .list-group-item-text {
  55. color: $list-group-active-text-color;
  56. }
  57. }
  58. }
  59. }
  60. .list-group-flush {
  61. .list-group-item {
  62. border-right: 0;
  63. border-left: 0;
  64. border-radius: 0;
  65. }
  66. }
  67. // Interactive list items
  68. //
  69. // Use anchor or button elements instead of `li`s or `div`s to create interactive
  70. // list items. Includes an extra `.active` modifier class for selected items.
  71. .list-group-item-action {
  72. width: 100%; // For `<button>`s (anchors become 100% by default though)
  73. color: $list-group-link-color;
  74. text-align: inherit; // For `<button>`s (anchors inherit)
  75. .list-group-item-heading {
  76. color: $list-group-link-heading-color;
  77. }
  78. // Hover state
  79. @include hover-focus {
  80. color: $list-group-link-hover-color;
  81. text-decoration: none;
  82. background-color: $list-group-hover-bg;
  83. }
  84. }
  85. // Contextual variants
  86. //
  87. // Add modifier classes to change text and background color on individual items.
  88. // Organizationally, this must come after the `:hover` states.
  89. @include list-group-item-variant(success, $state-success-bg, $state-success-text);
  90. @include list-group-item-variant(info, $state-info-bg, $state-info-text);
  91. @include list-group-item-variant(warning, $state-warning-bg, $state-warning-text);
  92. @include list-group-item-variant(danger, $state-danger-bg, $state-danger-text);
  93. // Custom content options
  94. //
  95. // Extra classes for creating well-formatted content within `.list-group-item`s.
  96. .list-group-item-heading {
  97. margin-top: 0;
  98. margin-bottom: $list-group-item-heading-margin-bottom;
  99. }
  100. .list-group-item-text {
  101. margin-bottom: 0;
  102. line-height: 1.3;
  103. }