list-group.less 3.1 KB

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