Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

245 lines
5.5KB

  1. //
  2. // Button groups
  3. // --------------------------------------------------
  4. // Make the div behave like a button
  5. .btn-group,
  6. .btn-group-vertical {
  7. position: relative;
  8. display: inline-block;
  9. vertical-align: middle; // match .btn alignment given font-size hack above
  10. > .btn {
  11. position: relative;
  12. float: left;
  13. // Bring the "active" button to the front
  14. &:hover,
  15. &:focus,
  16. &:active,
  17. &.active {
  18. z-index: 2;
  19. }
  20. }
  21. }
  22. // Prevent double borders when buttons are next to each other
  23. .btn-group {
  24. .btn + .btn,
  25. .btn + .btn-group,
  26. .btn-group + .btn,
  27. .btn-group + .btn-group {
  28. margin-left: -1px;
  29. }
  30. }
  31. // Optional: Group multiple button groups together for a toolbar
  32. .btn-toolbar {
  33. margin-left: -5px; // Offset the first child's margin
  34. &:extend(.clearfix all);
  35. .btn,
  36. .btn-group,
  37. .input-group {
  38. float: left;
  39. }
  40. > .btn,
  41. > .btn-group,
  42. > .input-group {
  43. margin-left: 5px;
  44. }
  45. }
  46. .btn-group > .btn:not(:first-child):not(:last-child):not(.dropdown-toggle) {
  47. border-radius: 0;
  48. }
  49. // 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
  50. .btn-group > .btn:first-child {
  51. margin-left: 0;
  52. &:not(:last-child):not(.dropdown-toggle) {
  53. .border-right-radius(0);
  54. }
  55. }
  56. // Need .dropdown-toggle since :last-child doesn't apply, given that a .dropdown-menu is used immediately after it
  57. .btn-group > .btn:last-child:not(:first-child),
  58. .btn-group > .dropdown-toggle:not(:first-child) {
  59. .border-left-radius(0);
  60. }
  61. // Custom edits for including btn-groups within btn-groups (useful for including dropdown buttons within a btn-group)
  62. .btn-group > .btn-group {
  63. float: left;
  64. }
  65. .btn-group > .btn-group:not(:first-child):not(:last-child) > .btn {
  66. border-radius: 0;
  67. }
  68. .btn-group > .btn-group:first-child:not(:last-child) {
  69. > .btn:last-child,
  70. > .dropdown-toggle {
  71. .border-right-radius(0);
  72. }
  73. }
  74. .btn-group > .btn-group:last-child:not(:first-child) > .btn:first-child {
  75. .border-left-radius(0);
  76. }
  77. // On active and open, don't show outline
  78. .btn-group .dropdown-toggle:active,
  79. .btn-group.open .dropdown-toggle {
  80. outline: 0;
  81. }
  82. // Sizing
  83. //
  84. // Remix the default button sizing classes into new ones for easier manipulation.
  85. .btn-group-xs > .btn { &:extend(.btn-xs); }
  86. .btn-group-sm > .btn { &:extend(.btn-sm); }
  87. .btn-group-lg > .btn { &:extend(.btn-lg); }
  88. // Split button dropdowns
  89. // ----------------------
  90. // Give the line between buttons some depth
  91. .btn-group > .btn + .dropdown-toggle {
  92. padding-left: 8px;
  93. padding-right: 8px;
  94. }
  95. .btn-group > .btn-lg + .dropdown-toggle {
  96. padding-left: 12px;
  97. padding-right: 12px;
  98. }
  99. // The clickable button for toggling the menu
  100. // Remove the gradient and set the same inset shadow as the :active state
  101. .btn-group.open .dropdown-toggle {
  102. .box-shadow(inset 0 3px 5px rgba(0,0,0,.125));
  103. // Show no shadow for `.btn-link` since it has no other button styles.
  104. &.btn-link {
  105. .box-shadow(none);
  106. }
  107. }
  108. // Reposition the caret
  109. .btn .caret {
  110. margin-left: 0;
  111. }
  112. // Carets in other button sizes
  113. .btn-lg .caret {
  114. border-width: @caret-width-large @caret-width-large 0;
  115. border-bottom-width: 0;
  116. }
  117. // Upside down carets for .dropup
  118. .dropup .btn-lg .caret {
  119. border-width: 0 @caret-width-large @caret-width-large;
  120. }
  121. // Vertical button groups
  122. // ----------------------
  123. .btn-group-vertical {
  124. > .btn,
  125. > .btn-group,
  126. > .btn-group > .btn {
  127. display: block;
  128. float: none;
  129. width: 100%;
  130. max-width: 100%;
  131. }
  132. // Clear floats so dropdown menus can be properly placed
  133. > .btn-group {
  134. &:extend(.clearfix all);
  135. > .btn {
  136. float: none;
  137. }
  138. }
  139. > .btn + .btn,
  140. > .btn + .btn-group,
  141. > .btn-group + .btn,
  142. > .btn-group + .btn-group {
  143. margin-top: -1px;
  144. margin-left: 0;
  145. }
  146. }
  147. .btn-group-vertical > .btn {
  148. &:not(:first-child):not(:last-child) {
  149. border-radius: 0;
  150. }
  151. &:first-child:not(:last-child) {
  152. .border-top-radius(@btn-border-radius-base);
  153. .border-bottom-radius(0);
  154. }
  155. &:last-child:not(:first-child) {
  156. .border-top-radius(0);
  157. .border-bottom-radius(@btn-border-radius-base);
  158. }
  159. }
  160. .btn-group-vertical > .btn-group:not(:first-child):not(:last-child) > .btn {
  161. border-radius: 0;
  162. }
  163. .btn-group-vertical > .btn-group:first-child:not(:last-child) {
  164. > .btn:last-child,
  165. > .dropdown-toggle {
  166. .border-bottom-radius(0);
  167. }
  168. }
  169. .btn-group-vertical > .btn-group:last-child:not(:first-child) > .btn:first-child {
  170. .border-top-radius(0);
  171. }
  172. // Justified button groups
  173. // ----------------------
  174. .btn-group-justified {
  175. display: table;
  176. width: 100%;
  177. table-layout: fixed;
  178. border-collapse: separate;
  179. > .btn,
  180. > .btn-group {
  181. float: none;
  182. display: table-cell;
  183. width: 1%;
  184. }
  185. > .btn-group .btn {
  186. width: 100%;
  187. }
  188. > .btn-group .dropdown-menu {
  189. left: auto;
  190. }
  191. }
  192. // Checkbox and radio options
  193. //
  194. // In order to support the browser's form validation feedback, powered by the
  195. // `required` attribute, we have to "hide" the inputs via `clip`. We cannot use
  196. // `display: none;` or `visibility: hidden;` as that also hides the popover.
  197. // Simply visually hiding the inputs via `opacity` would leave them clickable in
  198. // certain cases which is prevented by using `clip` and `pointer-events`.
  199. // This way, we ensure a DOM element is visible to position the popover from.
  200. //
  201. // See https://github.com/twbs/bootstrap/pull/12794 and
  202. // https://github.com/twbs/bootstrap/pull/14559 for more information.
  203. [data-toggle="buttons"] {
  204. > .btn,
  205. > .btn-group > .btn {
  206. input[type="radio"],
  207. input[type="checkbox"] {
  208. position: absolute;
  209. clip: rect(0,0,0,0);
  210. pointer-events: none;
  211. }
  212. }
  213. }