2 // Base styles for various input types, form layouts, and states
3 // -------------------------------------------------------------
9 // Make all forms have space below them
11 margin: 0 0 @baseLineHeight;
20 // Groups of fields with labels on top (legends)
25 margin-bottom: @baseLineHeight * 1.5;
26 font-size: @baseFontSize * 1.5;
27 line-height: @baseLineHeight * 2;
30 border-bottom: 1px solid #eee;
34 font-size: @baseLineHeight * .75;
45 #font > .shorthand(@baseFontSize,normal,@baseLineHeight); // Set size, weight, line-height here
51 #font > #family > .sans-serif(); // And only set font-family here for those that need it (note the missing label element)
54 // Identify controls by their labels
61 // Inputs, Textareas, Selects
66 display: inline-block;
68 height: @baseLineHeight;
71 font-size: @baseFontSize;
72 line-height: @baseLineHeight;
74 border: 1px solid #ccc;
77 .uneditable-textarea {
82 // Inputs within a label
89 // Mini reset for unique input types
91 input[type="checkbox"],
97 *margin-top: 0; /* IE7 */
101 border: 0 \9; /* IE9 and down */
103 input[type="image"] {
107 // Reset the file input to browser defaults
111 line-height: initial;
113 background-color: @white;
114 background-color: initial;
118 // Help out input buttons
119 input[type="button"],
121 input[type="submit"] {
126 // Set the height of select and file controls to match text inputs
129 height: 28px; /* In IE7, the height of the select element cannot be changed by height, only font-size */
130 *margin-top: 4px; /* For IE7, add top margin to align select with labels */
134 // Reset line-height for IE
136 line-height: 18px \9;
139 // Chrome on Linux and Mobile Safari need background-color
141 width: 220px; // default input width + 10px of padding that doesn't get applied
142 background-color: @white;
145 // Make multiple select elements height not fixed
151 // Remove shadow from image inputs
152 input[type="image"] {
156 // Make textarea height behave
168 // CHECKBOXES & RADIOS
169 // -------------------
171 // Indent the labels to position radios/checkboxes as hanging
176 .radio input[type="radio"],
177 .checkbox input[type="checkbox"] {
182 // Move the options list down to align with labels
183 .controls > .radio:first-child,
184 .controls > .checkbox:first-child {
185 padding-top: 5px; // has to be padding because margin collaspes
188 // Radios and checkboxes on same line
189 // TODO v3: Convert .inline to .control-inline
192 display: inline-block;
195 vertical-align: middle;
197 .radio.inline + .radio.inline,
198 .checkbox.inline + .checkbox.inline {
199 margin-left: 10px; // space out consecutive inline controls
209 .box-shadow(inset 0 1px 1px rgba(0,0,0,.075));
210 @transition: border linear .2s, box-shadow linear .2s;
211 .transition(@transition);
215 border-color: rgba(82,168,236,.8);
216 @shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6);
217 .box-shadow(@shadow);
219 outline: thin dotted \9; /* IE6-9 */
221 input[type="file"]:focus,
222 input[type="radio"]:focus,
223 input[type="checkbox"]:focus,
225 .box-shadow(none); // override for file inputs
234 // General classes for quick sizes
235 .input-mini { width: 60px; }
236 .input-small { width: 90px; }
237 .input-medium { width: 150px; }
238 .input-large { width: 210px; }
239 .input-xlarge { width: 270px; }
240 .input-xxlarge { width: 530px; }
242 // Grid style input sizes
243 input[class*="span"],
244 select[class*="span"],
245 textarea[class*="span"],
253 // GRID SIZING FOR INPUTS
254 // ----------------------
256 #inputGridSystem > .generate(@gridColumns, @gridColumnWidth, @gridGutterWidth);
264 // Disabled and read-only inputs
271 background-color: #f5f5f5;
279 // FORM FIELD FEEDBACK STATES
280 // --------------------------
283 .control-group.warning {
284 .formFieldState(darken(@orange, 10%), @orange, @warningBackground);
286 .control-group.warning .add-on {
287 background: @errorBackground;
288 color: darken(@orange, 10%);
289 border-color: darken(@orange, 10%);
295 .control-group.error {
296 .formFieldState(darken(@red, 10%), @red, @errorBackground);
298 .control-group.error .add-on {
299 background: @errorBackground;
300 color: darken(@red, 10%);
301 border-color: darken(@red, 10%);
305 .control-group.success {
306 .formFieldState(darken(@green, 10%), @green, @successBackground);
309 // HTML5 invalid states
310 // Shares styles with the .control-group.error above
311 input:focus:required:invalid,
312 textarea:focus:required:invalid,
313 select:focus:required:invalid {
315 border-color: #ee5f5b;
317 border-color: darken(#ee5f5b, 10%);
318 .box-shadow(0 0 6px lighten(#ee5f5b, 20%));
328 padding: (@baseLineHeight - 1) 20px @baseLineHeight;
329 margin-top: @baseLineHeight;
330 margin-bottom: @baseLineHeight;
331 background-color: #f5f5f5;
332 border-top: 1px solid #ddd;
335 // For text that needs to appear as an input but should not be an input
338 background-color: @white;
340 .box-shadow(inset 0 1px 2px rgba(0,0,0,.025));
344 // Placeholder text gets special styles; can't be bundled together though for some reason
345 .placeholder( lighten(@gray, 30%));
351 display: block; // account for any element using help-block
358 display: inline-block;
361 vertical-align: middle;
370 // Allow us to put symbols and text within the input field for a cleaner look
374 .clearfix(); // Clear the float to prevent wrapping
377 .border-radius(0 3px 3px 0);
384 border-left-color: #ccc;
390 height: @baseLineHeight;
394 line-height: @baseLineHeight;
397 text-shadow: 0 1px 0 @white;
398 background-color: #f5f5f5;
399 border: 1px solid #ccc;
400 .border-radius(3px 0 0 3px);
403 background-color: lighten(@green, 30);
404 border-color: @green;
409 *margin-top: 1px; /* IE6-7 */
415 .border-radius(3px 0 0 3px);
418 border-left-color: #eee;
419 border-right-color: #ccc;
424 .border-radius(0 3px 3px 0);
427 // In IE7, having a hasLayout container (from clearfix's zoom:1) can make the first input
428 // inherit the sum of its ancestors' margins.
429 *margin-left: -160px;
445 margin-bottom: 0; // remove the default margin on all inputs
446 .border-radius(14px);
451 // HORIZONTAL & VERTICAL FORMS
452 // ---------------------------
465 display: inline-block;
468 // Re-hide hide elements due to specifity
475 .form-search .input-append,
476 .form-inline .input-append,
477 .form-search .input-prepend,
478 .form-inline .input-prepend {
479 display: inline-block;
481 // Make the prepend and append add-on vertical-align: middle;
482 .form-search .input-append .add-on,
483 .form-inline .input-prepend .add-on,
484 .form-search .input-append .add-on,
485 .form-inline .input-prepend .add-on {
486 vertical-align: middle;
488 // Inline checkbox/radio labels
491 .form-search .checkbox,
492 .form-inline .checkbox {
494 vertical-align: middle;
497 // Margin to space out fieldsets
499 margin-bottom: @baseLineHeight / 2;
502 // Legend collapses margin, so next element is responsible for spacing
503 legend + .control-group {
504 margin-top: @baseLineHeight;
505 -webkit-margin-top-collapse: separate;
508 // Horizontal-specific styles
509 // --------------------------
512 // Increase spacing between groups
514 margin-bottom: @baseLineHeight;
517 // Float the labels left
524 // Move over all input controls and content
528 // Move over buttons in .form-actions to align with .controls