list-group.less 3.1 KB

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