diff options
Diffstat (limited to 'less/forms.less')
-rw-r--r-- | less/forms.less | 61 |
1 files changed, 47 insertions, 14 deletions
diff --git a/less/forms.less b/less/forms.less index f8d8562b60..e142f2ac37 100644 --- a/less/forms.less +++ b/less/forms.less @@ -81,11 +81,12 @@ input[type="color"], display: inline-block; height: @baseLineHeight; padding: 4px 6px; - margin-bottom: 9px; + margin-bottom: @baseLineHeight / 2; font-size: @baseFontSize; line-height: @baseLineHeight; color: @gray; .border-radius(@inputBorderRadius); + vertical-align: middle; } // Reset appearance properties for textual inputs and textarea @@ -126,7 +127,7 @@ input[type="color"], border-color: rgba(82,168,236,.8); outline: 0; outline: thin dotted \9; /* IE6-9 */ - .box-shadow(inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6)); + .box-shadow(~"inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(82,168,236,.6)"); } } @@ -154,9 +155,9 @@ input[type="checkbox"] { // Set the height of select and file controls to match text inputs select, input[type="file"] { - height: 30px; /* In IE7, the height of the select element cannot be changed by height, only font-size */ + height: @inputHeight; /* In IE7, the height of the select element cannot be changed by height, only font-size */ *margin-top: 4px; /* For IE7, add top margin to align select with labels */ - line-height: 30px; + line-height: @inputHeight; } // Make select elements obey height by applying a border @@ -210,7 +211,7 @@ input[type="checkbox"]:focus { // Placeholder // ------------------------- -// Placeholder text gets special styles because when browsers invalidate entire lines if it doesn’t understand a selector +// Placeholder text gets special styles because when browsers invalidate entire lines if it doesn't understand a selector input, textarea { .placeholder(); @@ -223,13 +224,13 @@ textarea { // Indent the labels to position radios/checkboxes as hanging .radio, .checkbox { - min-height: 18px; // clear the floating input if there is no label text - padding-left: 18px; + min-height: @baseLineHeight; // clear the floating input if there is no label text + padding-left: 20px; } .radio input[type="radio"], .checkbox input[type="checkbox"] { float: left; - margin-left: -18px; + margin-left: -20px; } // Move the options list down to align with labels @@ -304,8 +305,17 @@ textarea[class*="span"], .controls-row { .clearfix(); // Clear the float from controls } -.controls-row [class*="span"] { - float: left; // Float to collapse white-space for proper grid alignment + +// Float to collapse white-space for proper grid alignment +.controls-row [class*="span"], +// Redeclare the fluid grid collapse since we undo the float for inputs +.row-fluid .controls-row [class*="span"] { + float: left; +} +// Explicity set top padding on all checkboxes/radios, not just first-child +.controls-row .checkbox[class*="span"], +.controls-row .radio[class*="span"] { + padding-top: 5px; } @@ -364,7 +374,8 @@ select:focus:required:invalid { border-color: #ee5f5b; &:focus { border-color: darken(#ee5f5b, 10%); - .box-shadow(0 0 6px lighten(#ee5f5b, 20%)); + @shadow: 0 0 6px lighten(#ee5f5b, 20%); + .box-shadow(@shadow); } } @@ -413,16 +424,23 @@ select:focus:required:invalid { .input-append, .input-prepend { margin-bottom: 5px; - font-size: 0; + font-size: 0; // white space collapse hack white-space: nowrap; // Prevent span and input from separating + // Reset the white space collapse hack + input, + select, + .uneditable-input, + .dropdown-menu { + font-size: @baseFontSize; + } + input, select, .uneditable-input { position: relative; // placed here by default so that on :focus we can place the input above the .add-on for full border and box-shadow goodness margin-bottom: 0; // prevent bottom margin from screwing up alignment in stacked forms *margin-left: 0; - font-size: @baseFontSize; vertical-align: top; .border-radius(0 @inputBorderRadius @inputBorderRadius 0); // Make input on top when focused so blue border and shadow always show @@ -454,6 +472,7 @@ select:focus:required:invalid { border-color: @green; } } + .input-prepend { .add-on, .btn { @@ -461,17 +480,23 @@ select:focus:required:invalid { } .add-on:first-child, .btn:first-child { + // FYI, `.btn:first-child` accounts for a button group that's prepended .border-radius(@inputBorderRadius 0 0 @inputBorderRadius); } } + .input-append { input, select, .uneditable-input { .border-radius(@inputBorderRadius 0 0 @inputBorderRadius); + + .btn-group .btn { + .border-radius(0 @inputBorderRadius @inputBorderRadius 0); + } } .add-on, - .btn { + .btn, + .btn-group { margin-left: -1px; } .add-on:last-child, @@ -479,12 +504,16 @@ select:focus:required:invalid { .border-radius(0 @inputBorderRadius @inputBorderRadius 0); } } + // Remove all border-radius for inputs with both prepend and append .input-prepend.input-append { input, select, .uneditable-input { .border-radius(0); + + .btn-group .btn { + .border-radius(0 @inputBorderRadius @inputBorderRadius 0); + } } .add-on:first-child, .btn:first-child { @@ -496,10 +525,14 @@ select:focus:required:invalid { margin-left: -1px; .border-radius(0 @inputBorderRadius @inputBorderRadius 0); } + .btn-group:first-child { + margin-left: 0; + } } + // SEARCH FORM // ----------- |