Mercurial > wikked
comparison static/bootstrap/less/button-groups.less @ 149:d29e2f337b00
Updated to Bootstrap 3.0.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Thu, 12 Dec 2013 21:54:04 -0800 |
parents | a5a3d454eac9 |
children |
comparison
equal
deleted
inserted
replaced
148:f02e049d6546 | 149:d29e2f337b00 |
---|---|
1 // | 1 // |
2 // Button groups | 2 // Button groups |
3 // -------------------------------------------------- | 3 // -------------------------------------------------- |
4 | 4 |
5 | |
6 // Make the div behave like a button | 5 // Make the div behave like a button |
7 .btn-group { | 6 .btn-group, |
7 .btn-group-vertical { | |
8 position: relative; | 8 position: relative; |
9 display: inline-block; | 9 display: inline-block; |
10 .ie7-inline-block(); | |
11 font-size: 0; // remove as part 1 of font-size inline-block hack | |
12 vertical-align: middle; // match .btn alignment given font-size hack above | 10 vertical-align: middle; // match .btn alignment given font-size hack above |
13 white-space: nowrap; // prevent buttons from wrapping when in tight spaces (e.g., the table on the tests page) | 11 > .btn { |
14 .ie7-restore-left-whitespace(); | 12 position: relative; |
15 } | 13 float: left; |
16 | 14 // Bring the "active" button to the front |
17 // Space out series of button groups | 15 &:hover, |
18 .btn-group + .btn-group { | 16 &:focus, |
19 margin-left: 5px; | 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 } | |
20 } | 36 } |
21 | 37 |
22 // Optional: Group multiple button groups together for a toolbar | 38 // Optional: Group multiple button groups together for a toolbar |
23 .btn-toolbar { | 39 .btn-toolbar { |
24 font-size: 0; // Hack to remove whitespace that results from using inline-block | 40 .clearfix(); |
25 margin-top: @baseLineHeight / 2; | 41 |
26 margin-bottom: @baseLineHeight / 2; | 42 .btn-group { |
27 > .btn + .btn, | 43 float: left; |
28 > .btn-group + .btn, | 44 } |
29 > .btn + .btn-group { | 45 // Space out series of button groups |
30 margin-left: 5px; | 46 > .btn, |
31 } | 47 > .btn-group { |
32 } | 48 + .btn, |
33 | 49 + .btn-group { |
34 // Float them, remove border radius, then re-add to first and last elements | 50 margin-left: 5px; |
35 .btn-group > .btn { | 51 } |
36 position: relative; | 52 } |
37 .border-radius(0); | 53 } |
38 } | 54 |
39 .btn-group > .btn + .btn { | 55 .btn-group > .btn:not(:first-child):not(:last-child):not(.dropdown-toggle) { |
40 margin-left: -1px; | 56 border-radius: 0; |
41 } | |
42 .btn-group > .btn, | |
43 .btn-group > .dropdown-menu, | |
44 .btn-group > .popover { | |
45 font-size: @baseFontSize; // redeclare as part 2 of font-size inline-block hack | |
46 } | |
47 | |
48 // Reset fonts for other sizes | |
49 .btn-group > .btn-mini { | |
50 font-size: @fontSizeMini; | |
51 } | |
52 .btn-group > .btn-small { | |
53 font-size: @fontSizeSmall; | |
54 } | |
55 .btn-group > .btn-large { | |
56 font-size: @fontSizeLarge; | |
57 } | 57 } |
58 | 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 | 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 { | 60 .btn-group > .btn:first-child { |
61 margin-left: 0; | 61 margin-left: 0; |
62 .border-top-left-radius(@baseBorderRadius); | 62 &:not(:last-child):not(.dropdown-toggle) { |
63 .border-bottom-left-radius(@baseBorderRadius); | 63 .border-right-radius(0); |
64 } | |
64 } | 65 } |
65 // Need .dropdown-toggle since :last-child doesn't apply given a .dropdown-menu immediately after it | 66 // Need .dropdown-toggle since :last-child doesn't apply given a .dropdown-menu immediately after it |
66 .btn-group > .btn:last-child, | 67 .btn-group > .btn:last-child:not(:first-child), |
67 .btn-group > .dropdown-toggle { | 68 .btn-group > .dropdown-toggle:not(:first-child) { |
68 .border-top-right-radius(@baseBorderRadius); | 69 .border-left-radius(0); |
69 .border-bottom-right-radius(@baseBorderRadius); | 70 } |
70 } | 71 |
71 // Reset corners for large buttons | 72 // Custom edits for including btn-groups within btn-groups (useful for including dropdown buttons within a btn-group) |
72 .btn-group > .btn.large:first-child { | 73 .btn-group > .btn-group { |
73 margin-left: 0; | 74 float: left; |
74 .border-top-left-radius(@borderRadiusLarge); | 75 } |
75 .border-bottom-left-radius(@borderRadiusLarge); | 76 .btn-group > .btn-group:not(:first-child):not(:last-child) > .btn { |
76 } | 77 border-radius: 0; |
77 .btn-group > .btn.large:last-child, | 78 } |
78 .btn-group > .large.dropdown-toggle { | 79 .btn-group > .btn-group:first-child { |
79 .border-top-right-radius(@borderRadiusLarge); | 80 > .btn:last-child, |
80 .border-bottom-right-radius(@borderRadiusLarge); | 81 > .dropdown-toggle { |
81 } | 82 .border-right-radius(0); |
82 | 83 } |
83 // On hover/focus/active, bring the proper btn to front | 84 } |
84 .btn-group > .btn:hover, | 85 .btn-group > .btn-group:last-child > .btn:first-child { |
85 .btn-group > .btn:focus, | 86 .border-left-radius(0); |
86 .btn-group > .btn:active, | |
87 .btn-group > .btn.active { | |
88 z-index: 2; | |
89 } | 87 } |
90 | 88 |
91 // On active and open, don't show outline | 89 // On active and open, don't show outline |
92 .btn-group .dropdown-toggle:active, | 90 .btn-group .dropdown-toggle:active, |
93 .btn-group.open .dropdown-toggle { | 91 .btn-group.open .dropdown-toggle { |
94 outline: 0; | 92 outline: 0; |
95 } | 93 } |
96 | 94 |
97 | 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 | |
98 | 104 |
99 // Split button dropdowns | 105 // Split button dropdowns |
100 // ---------------------- | 106 // ---------------------- |
101 | 107 |
102 // Give the line between buttons some depth | 108 // Give the line between buttons some depth |
103 .btn-group > .btn + .dropdown-toggle { | 109 .btn-group > .btn + .dropdown-toggle { |
104 padding-left: 8px; | 110 padding-left: 8px; |
105 padding-right: 8px; | 111 padding-right: 8px; |
106 .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)"); | 112 } |
107 *padding-top: 5px; | 113 .btn-group > .btn-lg + .dropdown-toggle { |
108 *padding-bottom: 5px; | |
109 } | |
110 .btn-group > .btn-mini + .dropdown-toggle { | |
111 padding-left: 5px; | |
112 padding-right: 5px; | |
113 *padding-top: 2px; | |
114 *padding-bottom: 2px; | |
115 } | |
116 .btn-group > .btn-small + .dropdown-toggle { | |
117 *padding-top: 5px; | |
118 *padding-bottom: 4px; | |
119 } | |
120 .btn-group > .btn-large + .dropdown-toggle { | |
121 padding-left: 12px; | 114 padding-left: 12px; |
122 padding-right: 12px; | 115 padding-right: 12px; |
123 *padding-top: 7px; | 116 } |
124 *padding-bottom: 7px; | 117 |
125 } | 118 // The clickable button for toggling the menu |
126 | 119 // Remove the gradient and set the same inset shadow as the :active state |
127 .btn-group.open { | 120 .btn-group.open .dropdown-toggle { |
128 | 121 .box-shadow(inset 0 3px 5px rgba(0,0,0,.125)); |
129 // The clickable button for toggling the menu | 122 |
130 // Remove the gradient and set the same inset shadow as the :active state | 123 // Show no shadow for `.btn-link` since it has no other button styles. |
131 .dropdown-toggle { | 124 &.btn-link { |
132 background-image: none; | 125 .box-shadow(none); |
133 .box-shadow(~"inset 0 2px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.05)"); | |
134 } | |
135 | |
136 // Keep the hover's background when dropdown is open | |
137 .btn.dropdown-toggle { | |
138 background-color: @btnBackgroundHighlight; | |
139 } | |
140 .btn-primary.dropdown-toggle { | |
141 background-color: @btnPrimaryBackgroundHighlight; | |
142 } | |
143 .btn-warning.dropdown-toggle { | |
144 background-color: @btnWarningBackgroundHighlight; | |
145 } | |
146 .btn-danger.dropdown-toggle { | |
147 background-color: @btnDangerBackgroundHighlight; | |
148 } | |
149 .btn-success.dropdown-toggle { | |
150 background-color: @btnSuccessBackgroundHighlight; | |
151 } | |
152 .btn-info.dropdown-toggle { | |
153 background-color: @btnInfoBackgroundHighlight; | |
154 } | |
155 .btn-inverse.dropdown-toggle { | |
156 background-color: @btnInverseBackgroundHighlight; | |
157 } | 126 } |
158 } | 127 } |
159 | 128 |
160 | 129 |
161 // Reposition the caret | 130 // Reposition the caret |
162 .btn .caret { | 131 .btn .caret { |
163 margin-top: 8px; | |
164 margin-left: 0; | 132 margin-left: 0; |
165 } | 133 } |
166 // Carets in other button sizes | 134 // Carets in other button sizes |
167 .btn-large .caret { | 135 .btn-lg .caret { |
168 margin-top: 6px; | 136 border-width: @caret-width-large @caret-width-large 0; |
169 } | 137 border-bottom-width: 0; |
170 .btn-large .caret { | |
171 border-left-width: 5px; | |
172 border-right-width: 5px; | |
173 border-top-width: 5px; | |
174 } | |
175 .btn-mini .caret, | |
176 .btn-small .caret { | |
177 margin-top: 8px; | |
178 } | 138 } |
179 // Upside down carets for .dropup | 139 // Upside down carets for .dropup |
180 .dropup .btn-large .caret { | 140 .dropup .btn-lg .caret { |
181 border-bottom-width: 5px; | 141 border-width: 0 @caret-width-large @caret-width-large; |
182 } | 142 } |
183 | |
184 | |
185 | |
186 // Account for other colors | |
187 .btn-primary, | |
188 .btn-warning, | |
189 .btn-danger, | |
190 .btn-info, | |
191 .btn-success, | |
192 .btn-inverse { | |
193 .caret { | |
194 border-top-color: @white; | |
195 border-bottom-color: @white; | |
196 } | |
197 } | |
198 | |
199 | 143 |
200 | 144 |
201 // Vertical button groups | 145 // Vertical button groups |
202 // ---------------------- | 146 // ---------------------- |
203 | 147 |
204 .btn-group-vertical { | 148 .btn-group-vertical { |
205 display: inline-block; // makes buttons only take up the width they need | 149 > .btn, |
206 .ie7-inline-block(); | 150 > .btn-group, |
207 } | 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 | |
208 .btn-group-vertical > .btn { | 175 .btn-group-vertical > .btn { |
209 display: block; | 176 &:not(:first-child):not(:last-child) { |
210 float: none; | 177 border-radius: 0; |
211 max-width: 100%; | 178 } |
212 .border-radius(0); | 179 &:first-child:not(:last-child) { |
213 } | 180 border-top-right-radius: @border-radius-base; |
214 .btn-group-vertical > .btn + .btn { | 181 .border-bottom-radius(0); |
215 margin-left: 0; | 182 } |
216 margin-top: -1px; | 183 &:last-child:not(:first-child) { |
217 } | 184 border-bottom-left-radius: @border-radius-base; |
218 .btn-group-vertical > .btn:first-child { | 185 .border-top-radius(0); |
219 .border-radius(@baseBorderRadius @baseBorderRadius 0 0); | 186 } |
220 } | 187 } |
221 .btn-group-vertical > .btn:last-child { | 188 .btn-group-vertical > .btn-group:not(:first-child):not(:last-child) > .btn { |
222 .border-radius(0 0 @baseBorderRadius @baseBorderRadius); | 189 border-radius: 0; |
223 } | 190 } |
224 .btn-group-vertical > .btn-large:first-child { | 191 .btn-group-vertical > .btn-group:first-child { |
225 .border-radius(@borderRadiusLarge @borderRadiusLarge 0 0); | 192 > .btn:last-child, |
226 } | 193 > .dropdown-toggle { |
227 .btn-group-vertical > .btn-large:last-child { | 194 .border-bottom-radius(0); |
228 .border-radius(0 0 @borderRadiusLarge @borderRadiusLarge); | 195 } |
229 } | 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 } |