3 // --------------------------------------------------
6 // Normalize non-controls
8 // Restyle and baseline non-control form elements.
20 margin-bottom: @line-height-computed;
21 font-size: (@font-size-base * 1.5);
25 border-bottom: 1px solid @legend-border-color;
29 display: inline-block;
35 // Normalize form controls
37 // Override content-box in Normalize (* isn't specific enough)
38 input[type="search"] {
39 .box-sizing(border-box);
42 // Position radios and checkboxes better
44 input[type="checkbox"] {
46 margin-top: 1px \9; /* IE8-9 */
50 // Set the height of select and file controls to match text inputs
55 // Make multiple select elements height not fixed
61 // Fix optgroup Firefox bug per https://github.com/twbs/bootstrap/issues/7611
68 // Focus for select, file, radio, and checkbox
69 input[type="file"]:focus,
70 input[type="radio"]:focus,
71 input[type="checkbox"]:focus {
75 // Fix for Chrome number input
76 // Setting certain font-sizes causes the `I` bar to appear on hover of the bottom increment button.
77 // See https://github.com/twbs/bootstrap/issues/8350 for more.
78 input[type="number"] {
79 &::-webkit-outer-spin-button,
80 &::-webkit-inner-spin-button {
88 // Placeholder text gets special styles because when browsers invalidate entire
89 // lines if it doesn't understand a selector/
95 // Common form controls
97 // Shared size and type resets for form controls. Apply `.form-control` to any
98 // of the following form controls:
102 // input[type="text"]
103 // input[type="password"]
104 // input[type="datetime"]
105 // input[type="datetime-local"]
106 // input[type="date"]
107 // input[type="month"]
108 // input[type="time"]
109 // input[type="week"]
110 // input[type="number"]
111 // input[type="email"]
113 // input[type="search"]
115 // input[type="color"]
120 height: @input-height-base; // Make inputs at least the height of their button counterpart (base line-height + padding + border)
121 padding: @padding-base-vertical @padding-base-horizontal;
122 font-size: @font-size-base;
123 line-height: @line-height-base;
125 vertical-align: middle;
126 background-color: @input-bg;
127 border: 1px solid @input-border;
128 border-radius: @input-border-radius;
129 .box-shadow(inset 0 1px 1px rgba(0,0,0,.075));
130 .transition(~"border-color ease-in-out .15s, box-shadow ease-in-out .15s");
132 // Customize the `:focus` state to imitate native WebKit styles.
133 .form-control-focus();
135 // Disabled and read-only inputs
136 // Note: HTML5 says that controls under a fieldset > legend:first-child won't
137 // be disabled if the fieldset is disabled. Due to implementation difficulty,
138 // we don't honor that edge case; we style them as disabled anyway.
141 fieldset[disabled] & {
143 background-color: @input-bg-disabled;
146 // Reset height for `textarea`s
155 // Designed to help with the organization and spacing of vertical forms. For
156 // horizontal forms, use the predefined grid classes.
163 // Checkboxes and radios
165 // Indent the labels to position radios/checkboxes as hanging controls.
170 min-height: @line-height-computed; // clear the floating input if there is no label text
174 vertical-align: middle;
182 .radio input[type="radio"],
183 .radio-inline input[type="radio"],
184 .checkbox input[type="checkbox"],
185 .checkbox-inline input[type="checkbox"] {
190 .checkbox + .checkbox {
191 margin-top: -5px; // Move up sibling radios or checkboxes for tighter spacing
194 // Radios and checkboxes on same line
197 display: inline-block;
200 vertical-align: middle;
204 .radio-inline + .radio-inline,
205 .checkbox-inline + .checkbox-inline {
207 margin-left: 10px; // space out consecutive inline controls
210 // Apply same disabled cursor tweak as for inputs
212 // Note: Neither radios nor checkboxes can be readonly.
214 input[type="checkbox"],
220 fieldset[disabled] & {
225 // Form control sizing
227 .input-size(@input-height-small; @padding-small-vertical; @padding-small-horizontal; @font-size-small; @line-height-small; @border-radius-small);
231 .input-size(@input-height-large; @padding-large-vertical; @padding-large-horizontal; @font-size-large; @line-height-large; @border-radius-large);
235 // Form control feedback states
237 // Apply contextual and semantic states to individual form controls.
241 .form-control-validation(@state-warning-text; @state-warning-text; @state-warning-bg);
245 .form-control-validation(@state-danger-text; @state-danger-text; @state-danger-bg);
249 .form-control-validation(@state-success-text; @state-success-text; @state-success-bg);
253 // Static form control text
255 // Apply class to a `p` element to make any string of text align with labels in
256 // a horizontal form layout.
258 .form-control-static {
259 margin-bottom: 0; // Remove default margin from `p`
260 padding-top: @padding-base-vertical;
266 // Apply to any element you wish to create light text for placement immediately
267 // below a form control. Use for general help, formatting, or instructional text.
270 display: block; // account for any element using help-block
273 color: lighten(@text-color, 25%); // lighten the text some for contrast
280 // Make forms appear inline(-block) by adding the `.form-inline` class. Inline
281 // forms begin stacked on extra small (mobile) devices and then go inline when
282 // viewports reach <768px.
284 // Requires wrapping inputs and labels with `.form-group` for proper display of
285 // default HTML form controls and our custom form controls (e.g., input groups).
287 // Heads up! This is mixin-ed into `.navbar-form` in navbars.less.
291 // Kick in the inline
292 @media (min-width: @screen-tablet) {
293 // Inline-block all the things for "inline"
295 display: inline-block;
297 vertical-align: middle;
300 // In navbar-form, allow folks to *not* use `.form-group`
302 display: inline-block;
305 // Remove default margin on radios/checkboxes that were used for stacking, and
306 // then undo the floating of radios and checkboxes to match (which also avoids
307 // a bug in WebKit: https://github.com/twbs/bootstrap/issues/1969).
310 display: inline-block;
315 .radio input[type="radio"],
316 .checkbox input[type="checkbox"] {
326 // Horizontal forms are built on grid classes and allow you to create forms with
327 // labels on the left and inputs on the right.
329 .form-horizontal .control-label,
330 .form-horizontal .radio-inline,
331 .form-horizontal .checkbox-inline {
332 padding-top: @padding-base-vertical;
341 // Only right align form labels here when the columns stop stacking
342 @media (min-width: @screen-tablet) {
343 .form-horizontal .control-label {