list-group.less 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. // Align badges within list items
  32. > .badge {
  33. float: right;
  34. }
  35. > .badge + .badge {
  36. margin-right: 5px;
  37. }
  38. }
  39. // Linked list items
  40. //
  41. // Use anchor elements instead of `li`s or `div`s to create linked list items.
  42. // Includes an extra `.active` modifier class for showing selected items.
  43. a.list-group-item,
  44. button.list-group-item {
  45. color: @list-group-link-color;
  46. .list-group-item-heading {
  47. color: @list-group-link-heading-color;
  48. }
  49. // Hover state
  50. &:hover,
  51. &:focus {
  52. color: @list-group-hover-color;
  53. text-decoration: none;
  54. background-color: @list-group-hover-bg;
  55. }
  56. // Active class on item itself, not parent
  57. &.active,
  58. &.active:hover,
  59. &.active:focus {
  60. z-index: 2; // Place active items above their siblings for proper border styling
  61. color: @list-group-active-color;
  62. background-color: @list-group-active-bg;
  63. border-color: @list-group-active-border;
  64. // Force color to inherit for custom content
  65. .list-group-item-heading {
  66. color: inherit;
  67. }
  68. .list-group-item-text {
  69. color: @list-group-active-text-color;
  70. }
  71. }
  72. }
  73. // Custom content options
  74. //
  75. // Extra classes for creating well-formatted content within `.list-group-item`s.
  76. .list-group-item-heading {
  77. margin-top: 0;
  78. margin-bottom: 5px;
  79. }
  80. .list-group-item-text {
  81. margin-bottom: 0;
  82. line-height: 1.3;
  83. }