info@53: // info@53: // Forms info@53: // -------------------------------------------------- info@53: info@53: info@53: // Normalize non-controls info@53: // info@53: // Restyle and baseline non-control form elements. info@53: info@53: fieldset { info@53: padding: 0; info@53: margin: 0; info@53: border: 0; info@53: } info@53: info@53: legend { info@53: display: block; info@53: width: 100%; info@53: padding: 0; info@53: margin-bottom: @line-height-computed; info@53: font-size: (@font-size-base * 1.5); info@53: line-height: inherit; info@53: color: @legend-color; info@53: border: 0; info@53: border-bottom: 1px solid @legend-border-color; info@53: } info@53: info@53: label { info@53: display: inline-block; info@53: margin-bottom: 5px; info@53: font-weight: bold; info@53: } info@53: info@53: info@53: // Normalize form controls info@53: info@53: // Override content-box in Normalize (* isn't specific enough) info@53: input[type="search"] { info@53: .box-sizing(border-box); info@53: } info@53: info@53: // Position radios and checkboxes better info@53: input[type="radio"], info@53: input[type="checkbox"] { info@53: margin: 4px 0 0; info@53: margin-top: 1px \9; /* IE8-9 */ info@53: line-height: normal; info@53: } info@53: info@53: // Set the height of select and file controls to match text inputs info@53: input[type="file"] { info@53: display: block; info@53: } info@53: info@53: // Make multiple select elements height not fixed info@53: select[multiple], info@53: select[size] { info@53: height: auto; info@53: } info@53: info@53: // Fix optgroup Firefox bug per https://github.com/twbs/bootstrap/issues/7611 info@53: select optgroup { info@53: font-size: inherit; info@53: font-style: inherit; info@53: font-family: inherit; info@53: } info@53: info@53: // Focus for select, file, radio, and checkbox info@53: input[type="file"]:focus, info@53: input[type="radio"]:focus, info@53: input[type="checkbox"]:focus { info@53: .tab-focus(); info@53: } info@53: info@53: // Fix for Chrome number input info@53: // Setting certain font-sizes causes the `I` bar to appear on hover of the bottom increment button. info@53: // See https://github.com/twbs/bootstrap/issues/8350 for more. info@53: input[type="number"] { info@53: &::-webkit-outer-spin-button, info@53: &::-webkit-inner-spin-button { info@53: height: auto; info@53: } info@53: } info@53: info@53: // Adjust output element info@53: output { info@53: display: block; info@53: padding-top: (@padding-base-vertical + 1); info@53: font-size: @font-size-base; info@53: line-height: @line-height-base; info@53: color: @input-color; info@53: vertical-align: middle; info@53: } info@53: info@53: info@53: // Common form controls info@53: // info@53: // Shared size and type resets for form controls. Apply `.form-control` to any info@53: // of the following form controls: info@53: // info@53: // select info@53: // textarea info@53: // input[type="text"] info@53: // input[type="password"] info@53: // input[type="datetime"] info@53: // input[type="datetime-local"] info@53: // input[type="date"] info@53: // input[type="month"] info@53: // input[type="time"] info@53: // input[type="week"] info@53: // input[type="number"] info@53: // input[type="email"] info@53: // input[type="url"] info@53: // input[type="search"] info@53: // input[type="tel"] info@53: // input[type="color"] info@53: info@53: .form-control { info@53: display: block; info@53: width: 100%; info@53: height: @input-height-base; // Make inputs at least the height of their button counterpart (base line-height + padding + border) info@53: padding: @padding-base-vertical @padding-base-horizontal; info@53: font-size: @font-size-base; info@53: line-height: @line-height-base; info@53: color: @input-color; info@53: vertical-align: middle; info@53: background-color: @input-bg; info@53: background-image: none; // Reset unusual Firefox-on-Android default style; see https://github.com/necolas/normalize.css/issues/214 info@53: border: 1px solid @input-border; info@53: border-radius: @input-border-radius; info@53: .box-shadow(inset 0 1px 1px rgba(0,0,0,.075)); info@53: .transition(~"border-color ease-in-out .15s, box-shadow ease-in-out .15s"); info@53: info@53: // Customize the `:focus` state to imitate native WebKit styles. info@53: .form-control-focus(); info@53: info@53: // Placeholder info@53: // info@53: // Placeholder text gets special styles because when browsers invalidate entire info@53: // lines if it doesn't understand a selector/ info@53: .placeholder(); info@53: info@53: // Disabled and read-only inputs info@53: // Note: HTML5 says that controls under a fieldset > legend:first-child won't info@53: // be disabled if the fieldset is disabled. Due to implementation difficulty, info@53: // we don't honor that edge case; we style them as disabled anyway. info@53: &[disabled], info@53: &[readonly], info@53: fieldset[disabled] & { info@53: cursor: not-allowed; info@53: background-color: @input-bg-disabled; info@53: } info@53: info@53: // Reset height for `textarea`s info@53: textarea& { info@53: height: auto; info@53: } info@53: } info@53: info@53: info@53: // Form groups info@53: // info@53: // Designed to help with the organization and spacing of vertical forms. For info@53: // horizontal forms, use the predefined grid classes. info@53: info@53: .form-group { info@53: margin-bottom: 15px; info@53: } info@53: info@53: info@53: // Checkboxes and radios info@53: // info@53: // Indent the labels to position radios/checkboxes as hanging controls. info@53: info@53: .radio, info@53: .checkbox { info@53: display: block; info@53: min-height: @line-height-computed; // clear the floating input if there is no label text info@53: margin-top: 10px; info@53: margin-bottom: 10px; info@53: padding-left: 20px; info@53: vertical-align: middle; info@53: label { info@53: display: inline; info@53: margin-bottom: 0; info@53: font-weight: normal; info@53: cursor: pointer; info@53: } info@53: } info@53: .radio input[type="radio"], info@53: .radio-inline input[type="radio"], info@53: .checkbox input[type="checkbox"], info@53: .checkbox-inline input[type="checkbox"] { info@53: float: left; info@53: margin-left: -20px; info@53: } info@53: .radio + .radio, info@53: .checkbox + .checkbox { info@53: margin-top: -5px; // Move up sibling radios or checkboxes for tighter spacing info@53: } info@53: info@53: // Radios and checkboxes on same line info@53: .radio-inline, info@53: .checkbox-inline { info@53: display: inline-block; info@53: padding-left: 20px; info@53: margin-bottom: 0; info@53: vertical-align: middle; info@53: font-weight: normal; info@53: cursor: pointer; info@53: } info@53: .radio-inline + .radio-inline, info@53: .checkbox-inline + .checkbox-inline { info@53: margin-top: 0; info@53: margin-left: 10px; // space out consecutive inline controls info@53: } info@53: info@53: // Apply same disabled cursor tweak as for inputs info@53: // info@53: // Note: Neither radios nor checkboxes can be readonly. info@53: input[type="radio"], info@53: input[type="checkbox"], info@53: .radio, info@53: .radio-inline, info@53: .checkbox, info@53: .checkbox-inline { info@53: &[disabled], info@53: fieldset[disabled] & { info@53: cursor: not-allowed; info@53: } info@53: } info@53: info@53: // Form control sizing info@53: .input-sm { info@53: .input-size(@input-height-small; @padding-small-vertical; @padding-small-horizontal; @font-size-small; @line-height-small; @border-radius-small); info@53: } info@53: info@53: .input-lg { info@53: .input-size(@input-height-large; @padding-large-vertical; @padding-large-horizontal; @font-size-large; @line-height-large; @border-radius-large); info@53: } info@53: info@53: info@53: // Form control feedback states info@53: // info@53: // Apply contextual and semantic states to individual form controls. info@53: info@53: // Warning info@53: .has-warning { info@53: .form-control-validation(@state-warning-text; @state-warning-text; @state-warning-bg); info@53: } info@53: // Error info@53: .has-error { info@53: .form-control-validation(@state-danger-text; @state-danger-text; @state-danger-bg); info@53: } info@53: // Success info@53: .has-success { info@53: .form-control-validation(@state-success-text; @state-success-text; @state-success-bg); info@53: } info@53: info@53: info@53: // Static form control text info@53: // info@53: // Apply class to a `p` element to make any string of text align with labels in info@53: // a horizontal form layout. info@53: info@53: .form-control-static { info@53: margin-bottom: 0; // Remove default margin from `p` info@53: } info@53: info@53: info@53: // Help text info@53: // info@53: // Apply to any element you wish to create light text for placement immediately info@53: // below a form control. Use for general help, formatting, or instructional text. info@53: info@53: .help-block { info@53: display: block; // account for any element using help-block info@53: margin-top: 5px; info@53: margin-bottom: 10px; info@53: color: lighten(@text-color, 25%); // lighten the text some for contrast info@53: } info@53: info@53: info@53: info@53: // Inline forms info@53: // info@53: // Make forms appear inline(-block) by adding the `.form-inline` class. Inline info@53: // forms begin stacked on extra small (mobile) devices and then go inline when info@53: // viewports reach <768px. info@53: // info@53: // Requires wrapping inputs and labels with `.form-group` for proper display of info@53: // default HTML form controls and our custom form controls (e.g., input groups). info@53: // info@53: // Heads up! This is mixin-ed into `.navbar-form` in navbars.less. info@53: info@53: .form-inline { info@53: info@53: // Kick in the inline info@53: @media (min-width: @screen-sm) { info@53: // Inline-block all the things for "inline" info@53: .form-group { info@53: display: inline-block; info@53: margin-bottom: 0; info@53: vertical-align: middle; info@53: } info@53: info@53: // In navbar-form, allow folks to *not* use `.form-group` info@53: .form-control { info@53: display: inline-block; info@53: } info@53: info@53: // Override `width: 100%;` when not within a `.form-group` info@53: select.form-control { info@53: width: auto; info@53: } info@53: info@53: // Remove default margin on radios/checkboxes that were used for stacking, and info@53: // then undo the floating of radios and checkboxes to match (which also avoids info@53: // a bug in WebKit: https://github.com/twbs/bootstrap/issues/1969). info@53: .radio, info@53: .checkbox { info@53: display: inline-block; info@53: margin-top: 0; info@53: margin-bottom: 0; info@53: padding-left: 0; info@53: } info@53: .radio input[type="radio"], info@53: .checkbox input[type="checkbox"] { info@53: float: none; info@53: margin-left: 0; info@53: } info@53: } info@53: } info@53: info@53: info@53: // Horizontal forms info@53: // info@53: // Horizontal forms are built on grid classes and allow you to create forms with info@53: // labels on the left and inputs on the right. info@53: info@53: .form-horizontal { info@53: info@53: // Consistent vertical alignment of labels, radios, and checkboxes info@53: .control-label, info@53: .radio, info@53: .checkbox, info@53: .radio-inline, info@53: .checkbox-inline { info@53: margin-top: 0; info@53: margin-bottom: 0; info@53: padding-top: (@padding-base-vertical + 1); // Default padding plus a border info@53: } info@53: // Account for padding we're adding to ensure the alignment and of help text info@53: // and other content below items info@53: .radio, info@53: .checkbox { info@53: min-height: @line-height-computed + (@padding-base-vertical + 1); info@53: } info@53: info@53: // Make form groups behave like rows info@53: .form-group { info@53: .make-row(); info@53: } info@53: info@53: .form-control-static { info@53: padding-top: (@padding-base-vertical + 1); info@53: } info@53: info@53: // Only right align form labels here when the columns stop stacking info@53: @media (min-width: @screen-sm-min) { info@53: .control-label { info@53: text-align: right; info@53: } info@53: } info@53: }