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