corrade-nucleus-nucleons – Blame information for rev 20

Subversion Repositories:
Rev:
Rev Author Line No. Line
20 office 1 //
2 // Forms
3 // --------------------------------------------------
4  
5  
6 // Normalize non-controls
7 //
8 // Restyle and baseline non-control form elements.
9  
10 fieldset {
11 padding: 0;
12 margin: 0;
13 border: 0;
14 // Chrome and Firefox set a `min-width: -webkit-min-content;` on fieldsets,
15 // so we reset that to ensure it behaves more like a standard block element.
16 // See https://github.com/twbs/bootstrap/issues/12359.
17 min-width: 0;
18 }
19  
20 legend {
21 display: block;
22 width: 100%;
23 padding: 0;
24 margin-bottom: @line-height-computed;
25 font-size: (@font-size-base * 1.5);
26 line-height: inherit;
27 color: @legend-color;
28 border: 0;
29 border-bottom: 1px solid @legend-border-color;
30 }
31  
32 label {
33 display: inline-block;
34 margin-bottom: 5px;
35 font-weight: bold;
36 }
37  
38  
39 // Normalize form controls
40 //
41 // While most of our form styles require extra classes, some basic normalization
42 // is required to ensure optimum display with or without those classes to better
43 // address browser inconsistencies.
44  
45 // Override content-box in Normalize (* isn't specific enough)
46 input[type="search"] {
47 .box-sizing(border-box);
48 }
49  
50 // Position radios and checkboxes better
51 input[type="radio"],
52 input[type="checkbox"] {
53 margin: 4px 0 0;
54 margin-top: 1px \9; /* IE8-9 */
55 line-height: normal;
56 }
57  
58 // Set the height of file controls to match text inputs
59 input[type="file"] {
60 display: block;
61 }
62  
63 // Make range inputs behave like textual form controls
64 input[type="range"] {
65 display: block;
66 width: 100%;
67 }
68  
69 // Make multiple select elements height not fixed
70 select[multiple],
71 select[size] {
72 height: auto;
73 }
74  
75 // Focus for file, radio, and checkbox
76 input[type="file"]:focus,
77 input[type="radio"]:focus,
78 input[type="checkbox"]:focus {
79 .tab-focus();
80 }
81  
82 // Adjust output element
83 output {
84 display: block;
85 padding-top: (@padding-base-vertical + 1);
86 font-size: @font-size-base;
87 line-height: @line-height-base;
88 color: @input-color;
89 }
90  
91  
92 // Common form controls
93 //
94 // Shared size and type resets for form controls. Apply `.form-control` to any
95 // of the following form controls:
96 //
97 // select
98 // textarea
99 // input[type="text"]
100 // input[type="password"]
101 // input[type="datetime"]
102 // input[type="datetime-local"]
103 // input[type="date"]
104 // input[type="month"]
105 // input[type="time"]
106 // input[type="week"]
107 // input[type="number"]
108 // input[type="email"]
109 // input[type="url"]
110 // input[type="search"]
111 // input[type="tel"]
112 // input[type="color"]
113  
114 .form-control {
115 display: block;
116 width: 100%;
117 height: @input-height-base; // Make inputs at least the height of their button counterpart (base line-height + padding + border)
118 padding: @padding-base-vertical @padding-base-horizontal;
119 font-size: @font-size-base;
120 line-height: @line-height-base;
121 color: @input-color;
122 background-color: @input-bg;
123 background-image: none; // Reset unusual Firefox-on-Android default style; see https://github.com/necolas/normalize.css/issues/214
124 border: 1px solid @input-border;
125 border-radius: @input-border-radius;
126 .box-shadow(inset 0 1px 1px rgba(0,0,0,.075));
127 .transition(~"border-color ease-in-out .15s, box-shadow ease-in-out .15s");
128  
129 // Customize the `:focus` state to imitate native WebKit styles.
130 .form-control-focus();
131  
132 // Placeholder
133 .placeholder();
134  
135 // Disabled and read-only inputs
136 //
137 // HTML5 says that controls under a fieldset > legend:first-child won't be
138 // disabled if the fieldset is disabled. Due to implementation difficulty, we
139 // don't honor that edge case; we style them as disabled anyway.
140 &[disabled],
141 &[readonly],
142 fieldset[disabled] & {
143 cursor: not-allowed;
144 background-color: @input-bg-disabled;
145 opacity: 1; // iOS fix for unreadable disabled content
146 }
147  
148 // Reset height for `textarea`s
149 textarea& {
150 height: auto;
151 }
152 }
153  
154  
155 // Search inputs in iOS
156 //
157 // This overrides the extra rounded corners on search inputs in iOS so that our
158 // `.form-control` class can properly style them. Note that this cannot simply
159 // be added to `.form-control` as it's not specific enough. For details, see
160 // https://github.com/twbs/bootstrap/issues/11586.
161  
162 input[type="search"] {
163 -webkit-appearance: none;
164 }
165  
166  
167 // Special styles for iOS date input
168 //
169 // In Mobile Safari, date inputs require a pixel line-height that matches the
170 // given height of the input.
171  
172 input[type="date"] {
173 line-height: @input-height-base;
174 }
175  
176  
177 // Form groups
178 //
179 // Designed to help with the organization and spacing of vertical forms. For
180 // horizontal forms, use the predefined grid classes.
181  
182 .form-group {
183 margin-bottom: 15px;
184 }
185  
186  
187 // Checkboxes and radios
188 //
189 // Indent the labels to position radios/checkboxes as hanging controls.
190  
191 .radio,
192 .checkbox {
193 display: block;
194 min-height: @line-height-computed; // clear the floating input if there is no label text
195 margin-top: 10px;
196 margin-bottom: 10px;
197 padding-left: 20px;
198 label {
199 display: inline;
200 font-weight: normal;
201 cursor: pointer;
202 }
203 }
204 .radio input[type="radio"],
205 .radio-inline input[type="radio"],
206 .checkbox input[type="checkbox"],
207 .checkbox-inline input[type="checkbox"] {
208 float: left;
209 margin-left: -20px;
210 }
211 .radio + .radio,
212 .checkbox + .checkbox {
213 margin-top: -5px; // Move up sibling radios or checkboxes for tighter spacing
214 }
215  
216 // Radios and checkboxes on same line
217 .radio-inline,
218 .checkbox-inline {
219 display: inline-block;
220 padding-left: 20px;
221 margin-bottom: 0;
222 vertical-align: middle;
223 font-weight: normal;
224 cursor: pointer;
225 }
226 .radio-inline + .radio-inline,
227 .checkbox-inline + .checkbox-inline {
228 margin-top: 0;
229 margin-left: 10px; // space out consecutive inline controls
230 }
231  
232 // Apply same disabled cursor tweak as for inputs
233 //
234 // Note: Neither radios nor checkboxes can be readonly.
235 input[type="radio"],
236 input[type="checkbox"],
237 .radio,
238 .radio-inline,
239 .checkbox,
240 .checkbox-inline {
241 &[disabled],
242 fieldset[disabled] & {
243 cursor: not-allowed;
244 }
245 }
246  
247  
248 // Form control sizing
249 //
250 // Build on `.form-control` with modifier classes to decrease or increase the
251 // height and font-size of form controls.
252  
253 .input-sm {
254 .input-size(@input-height-small; @padding-small-vertical; @padding-small-horizontal; @font-size-small; @line-height-small; @border-radius-small);
255 }
256  
257 .input-lg {
258 .input-size(@input-height-large; @padding-large-vertical; @padding-large-horizontal; @font-size-large; @line-height-large; @border-radius-large);
259 }
260  
261  
262 // Form control feedback states
263 //
264 // Apply contextual and semantic states to individual form controls.
265  
266 .has-feedback {
267 // Enable absolute positioning
268 position: relative;
269  
270 // Ensure icons don't overlap text
271 .form-control {
272 padding-right: (@input-height-base * 1.25);
273 }
274  
275 // Feedback icon (requires .glyphicon classes)
276 .form-control-feedback {
277 position: absolute;
278 top: (@line-height-computed + 5); // Height of the `label` and its margin
279 right: 0;
280 display: block;
281 width: @input-height-base;
282 height: @input-height-base;
283 line-height: @input-height-base;
284 text-align: center;
285 }
286 }
287  
288 // Feedback states
289 .has-success {
290 .form-control-validation(@state-success-text; @state-success-text; @state-success-bg);
291 }
292 .has-warning {
293 .form-control-validation(@state-warning-text; @state-warning-text; @state-warning-bg);
294 }
295 .has-error {
296 .form-control-validation(@state-danger-text; @state-danger-text; @state-danger-bg);
297 }
298  
299  
300 // Static form control text
301 //
302 // Apply class to a `p` element to make any string of text align with labels in
303 // a horizontal form layout.
304  
305 .form-control-static {
306 margin-bottom: 0; // Remove default margin from `p`
307 }
308  
309  
310 // Help text
311 //
312 // Apply to any element you wish to create light text for placement immediately
313 // below a form control. Use for general help, formatting, or instructional text.
314  
315 .help-block {
316 display: block; // account for any element using help-block
317 margin-top: 5px;
318 margin-bottom: 10px;
319 color: lighten(@text-color, 25%); // lighten the text some for contrast
320 }
321  
322  
323  
324 // Inline forms
325 //
326 // Make forms appear inline(-block) by adding the `.form-inline` class. Inline
327 // forms begin stacked on extra small (mobile) devices and then go inline when
328 // viewports reach <768px.
329 //
330 // Requires wrapping inputs and labels with `.form-group` for proper display of
331 // default HTML form controls and our custom form controls (e.g., input groups).
332 //
333 // Heads up! This is mixin-ed into `.navbar-form` in navbars.less.
334  
335 .form-inline {
336  
337 // Kick in the inline
338 @media (min-width: @screen-sm-min) {
339 // Inline-block all the things for "inline"
340 .form-group {
341 display: inline-block;
342 margin-bottom: 0;
343 vertical-align: middle;
344 }
345  
346 // In navbar-form, allow folks to *not* use `.form-group`
347 .form-control {
348 display: inline-block;
349 width: auto; // Prevent labels from stacking above inputs in `.form-group`
350 vertical-align: middle;
351 }
352 // Input groups need that 100% width though
353 .input-group > .form-control {
354 width: 100%;
355 }
356  
357 .control-label {
358 margin-bottom: 0;
359 vertical-align: middle;
360 }
361  
362 // Remove default margin on radios/checkboxes that were used for stacking, and
363 // then undo the floating of radios and checkboxes to match (which also avoids
364 // a bug in WebKit: https://github.com/twbs/bootstrap/issues/1969).
365 .radio,
366 .checkbox {
367 display: inline-block;
368 margin-top: 0;
369 margin-bottom: 0;
370 padding-left: 0;
371 vertical-align: middle;
372 }
373 .radio input[type="radio"],
374 .checkbox input[type="checkbox"] {
375 float: none;
376 margin-left: 0;
377 }
378  
379 // Validation states
380 //
381 // Reposition the icon because it's now within a grid column and columns have
382 // `position: relative;` on them. Also accounts for the grid gutter padding.
383 .has-feedback .form-control-feedback {
384 top: 0;
385 }
386 }
387 }
388  
389  
390 // Horizontal forms
391 //
392 // Horizontal forms are built on grid classes and allow you to create forms with
393 // labels on the left and inputs on the right.
394  
395 .form-horizontal {
396  
397 // Consistent vertical alignment of labels, radios, and checkboxes
398 .control-label,
399 .radio,
400 .checkbox,
401 .radio-inline,
402 .checkbox-inline {
403 margin-top: 0;
404 margin-bottom: 0;
405 padding-top: (@padding-base-vertical + 1); // Default padding plus a border
406 }
407 // Account for padding we're adding to ensure the alignment and of help text
408 // and other content below items
409 .radio,
410 .checkbox {
411 min-height: (@line-height-computed + (@padding-base-vertical + 1));
412 }
413  
414 // Make form groups behave like rows
415 .form-group {
416 .make-row();
417 }
418  
419 .form-control-static {
420 padding-top: (@padding-base-vertical + 1);
421 }
422  
423 // Only right align form labels here when the columns stop stacking
424 @media (min-width: @screen-sm-min) {
425 .control-label {
426 text-align: right;
427 }
428 }
429  
430 // Validation states
431 //
432 // Reposition the icon because it's now within a grid column and columns have
433 // `position: relative;` on them. Also accounts for the grid gutter padding.
434 .has-feedback .form-control-feedback {
435 top: 0;
436 right: (@grid-gutter-width / 2);
437 }
438 }