button-groups.less.svn-base 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. // BUTTON GROUPS
  2. // -------------
  3. // Make the div behave like a button
  4. .btn-group {
  5. position: relative;
  6. .clearfix(); // clears the floated buttons
  7. .ie7-restore-left-whitespace();
  8. }
  9. // Space out series of button groups
  10. .btn-group + .btn-group {
  11. margin-left: 5px;
  12. }
  13. // Optional: Group multiple button groups together for a toolbar
  14. .btn-toolbar {
  15. margin-top: @baseLineHeight / 2;
  16. margin-bottom: @baseLineHeight / 2;
  17. .btn-group {
  18. display: inline-block;
  19. .ie7-inline-block();
  20. }
  21. }
  22. // Float them, remove border radius, then re-add to first and last elements
  23. .btn-group > .btn {
  24. position: relative;
  25. float: left;
  26. margin-left: -1px;
  27. .border-radius(0);
  28. }
  29. // Set corners individual because sometimes a single button can be in a .btn-group and we need :first-child and :last-child to both match
  30. .btn-group > .btn:first-child {
  31. margin-left: 0;
  32. -webkit-border-top-left-radius: 4px;
  33. -moz-border-radius-topleft: 4px;
  34. border-top-left-radius: 4px;
  35. -webkit-border-bottom-left-radius: 4px;
  36. -moz-border-radius-bottomleft: 4px;
  37. border-bottom-left-radius: 4px;
  38. }
  39. // Need .dropdown-toggle since :last-child doesn't apply given a .dropdown-menu immediately after it
  40. .btn-group > .btn:last-child,
  41. .btn-group > .dropdown-toggle {
  42. -webkit-border-top-right-radius: 4px;
  43. -moz-border-radius-topright: 4px;
  44. border-top-right-radius: 4px;
  45. -webkit-border-bottom-right-radius: 4px;
  46. -moz-border-radius-bottomright: 4px;
  47. border-bottom-right-radius: 4px;
  48. }
  49. // Reset corners for large buttons
  50. .btn-group > .btn.large:first-child {
  51. margin-left: 0;
  52. -webkit-border-top-left-radius: 6px;
  53. -moz-border-radius-topleft: 6px;
  54. border-top-left-radius: 6px;
  55. -webkit-border-bottom-left-radius: 6px;
  56. -moz-border-radius-bottomleft: 6px;
  57. border-bottom-left-radius: 6px;
  58. }
  59. .btn-group > .btn.large:last-child,
  60. .btn-group > .large.dropdown-toggle {
  61. -webkit-border-top-right-radius: 6px;
  62. -moz-border-radius-topright: 6px;
  63. border-top-right-radius: 6px;
  64. -webkit-border-bottom-right-radius: 6px;
  65. -moz-border-radius-bottomright: 6px;
  66. border-bottom-right-radius: 6px;
  67. }
  68. // On hover/focus/active, bring the proper btn to front
  69. .btn-group > .btn:hover,
  70. .btn-group > .btn:focus,
  71. .btn-group > .btn:active,
  72. .btn-group > .btn.active {
  73. z-index: 2;
  74. }
  75. // On active and open, don't show outline
  76. .btn-group .dropdown-toggle:active,
  77. .btn-group.open .dropdown-toggle {
  78. outline: 0;
  79. }
  80. // Split button dropdowns
  81. // ----------------------
  82. // Give the line between buttons some depth
  83. .btn-group > .dropdown-toggle {
  84. padding-left: 8px;
  85. padding-right: 8px;
  86. .box-shadow(~"inset 1px 0 0 rgba(255,255,255,.125), inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05)");
  87. *padding-top: 4px;
  88. *padding-bottom: 4px;
  89. }
  90. .btn-group > .btn-mini.dropdown-toggle {
  91. padding-left: 5px;
  92. padding-right: 5px;
  93. }
  94. .btn-group > .btn-small.dropdown-toggle {
  95. *padding-top: 4px;
  96. *padding-bottom: 4px;
  97. }
  98. .btn-group > .btn-large.dropdown-toggle {
  99. padding-left: 12px;
  100. padding-right: 12px;
  101. }
  102. .btn-group.open {
  103. // The clickable button for toggling the menu
  104. // Remove the gradient and set the same inset shadow as the :active state
  105. .dropdown-toggle {
  106. background-image: none;
  107. .box-shadow(~"inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05)");
  108. }
  109. // Keep the hover's background when dropdown is open
  110. .btn.dropdown-toggle {
  111. background-color: @btnBackgroundHighlight;
  112. }
  113. .btn-primary.dropdown-toggle {
  114. background-color: @btnPrimaryBackgroundHighlight;
  115. }
  116. .btn-warning.dropdown-toggle {
  117. background-color: @btnWarningBackgroundHighlight;
  118. }
  119. .btn-danger.dropdown-toggle {
  120. background-color: @btnDangerBackgroundHighlight;
  121. }
  122. .btn-success.dropdown-toggle {
  123. background-color: @btnSuccessBackgroundHighlight;
  124. }
  125. .btn-info.dropdown-toggle {
  126. background-color: @btnInfoBackgroundHighlight;
  127. }
  128. .btn-inverse.dropdown-toggle {
  129. background-color: @btnInverseBackgroundHighlight;
  130. }
  131. }
  132. // Reposition the caret
  133. .btn .caret {
  134. margin-top: 7px;
  135. margin-left: 0;
  136. }
  137. .btn:hover .caret,
  138. .open.btn-group .caret {
  139. .opacity(100);
  140. }
  141. // Carets in other button sizes
  142. .btn-mini .caret {
  143. margin-top: 5px;
  144. }
  145. .btn-small .caret {
  146. margin-top: 6px;
  147. }
  148. .btn-large .caret {
  149. margin-top: 6px;
  150. border-left-width: 5px;
  151. border-right-width: 5px;
  152. border-top-width: 5px;
  153. }
  154. // Upside down carets for .dropup
  155. .dropup .btn-large .caret {
  156. border-bottom: 5px solid @black;
  157. border-top: 0;
  158. }
  159. // Account for other colors
  160. .btn-primary,
  161. .btn-warning,
  162. .btn-danger,
  163. .btn-info,
  164. .btn-success,
  165. .btn-inverse {
  166. .caret {
  167. border-top-color: @white;
  168. border-bottom-color: @white;
  169. .opacity(75);
  170. }
  171. }