aboutsummaryrefslogtreecommitdiff
path: root/less/forms.less
diff options
context:
space:
mode:
authorJacob Thornton <[email protected]>2012-08-20 16:13:46 -0700
committerJacob Thornton <[email protected]>2012-08-20 16:13:46 -0700
commit5d63e8e2a84468351b4c1ee6cc21f48e95ea27bf (patch)
tree2d760c794e61c15850d14d5eee1c565ab4f9a871 /less/forms.less
parent5df1e2c00a295c45db7fa75dba333dc9464b128c (diff)
parentaa2cec6f2f706f8c1754f8bf79a8c9f094445bd8 (diff)
downloadbootstrap-5d63e8e2a84468351b4c1ee6cc21f48e95ea27bf.tar.xz
bootstrap-5d63e8e2a84468351b4c1ee6cc21f48e95ea27bf.zip
fMerge branch '2.1.0-wip'
Conflicts: docs/index.html
Diffstat (limited to 'less/forms.less')
-rw-r--r--less/forms.less148
1 files changed, 100 insertions, 48 deletions
diff --git a/less/forms.less b/less/forms.less
index 1163fe914..77b5135a4 100644
--- a/less/forms.less
+++ b/less/forms.less
@@ -1,6 +1,6 @@
-// Forms.less
-// Base styles for various input types, form layouts, and states
-// -------------------------------------------------------------
+//
+// Forms
+// --------------------------------------------------
// GENERAL STYLES
@@ -22,7 +22,7 @@ legend {
display: block;
width: 100%;
padding: 0;
- margin-bottom: @baseLineHeight * 1.5;
+ margin-bottom: @baseLineHeight;
font-size: @baseFontSize * 1.5;
line-height: @baseLineHeight * 2;
color: @grayDark;
@@ -80,11 +80,12 @@ input[type="color"],
.uneditable-input {
display: inline-block;
height: @baseLineHeight;
- padding: 4px;
+ padding: 4px 6px;
margin-bottom: 9px;
font-size: @baseFontSize;
line-height: @baseLineHeight;
color: @gray;
+ .border-radius(@inputBorderRadius);
}
// Reset appearance properties for textual inputs and textarea
@@ -116,10 +117,8 @@ input[type="color"],
.uneditable-input {
background-color: @inputBackground;
border: 1px solid @inputBorder;
- .border-radius(@inputBorderRadius);
.box-shadow(inset 0 1px 1px rgba(0,0,0,.075));
- @transition: border linear .2s, box-shadow linear .2s;
- .transition(@transition);
+ .transition(~"border linear .2s, box-shadow linear .2s");
// Focus state
&:focus {
@@ -133,13 +132,16 @@ input[type="color"],
// Position radios and checkboxes better
input[type="radio"],
input[type="checkbox"] {
- margin: 3px 0;
+ margin: 4px 0 0;
*margin-top: 0; /* IE7 */
+ margin-top: 1px \9; /* IE8-9 */
line-height: normal;
cursor: pointer;
}
-// Reset width of input buttons, radios, checkboxes
+// Reset width of input images, buttons, radios, checkboxes
+input[type="file"],
+input[type="image"],
input[type="submit"],
input[type="reset"],
input[type="button"],
@@ -148,24 +150,19 @@ input[type="checkbox"] {
width: auto; // Override of generic input selector
}
-// Make uneditable textareas behave like a textarea
-.uneditable-textarea {
- width: auto;
- height: auto;
-}
-
// Set the height of select and file controls to match text inputs
select,
input[type="file"] {
- height: 28px; /* In IE7, the height of the select element cannot be changed by height, only font-size */
+ height: 30px; /* 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: 28px;
+ line-height: 30px;
}
// Make select elements obey height by applying a border
select {
width: 220px; // default input width + 10px of padding that doesn't get applied
border: 1px solid #bbb;
+ background-color: @inputBackground; // Chrome on Linux and Mobile Safari need background-color
}
// Make multiple select elements height not fixed
@@ -183,6 +180,41 @@ input[type="checkbox"]:focus {
}
+// Uneditable inputs
+// -------------------------
+
+// Make uneditable inputs look inactive
+.uneditable-input,
+.uneditable-textarea {
+ color: @grayLight;
+ background-color: darken(@inputBackground, 1%);
+ border-color: @inputBorder;
+ .box-shadow(inset 0 1px 2px rgba(0,0,0,.025));
+ cursor: not-allowed;
+}
+
+// For text that needs to appear as an input but should not be an input
+.uneditable-input {
+ overflow: hidden; // prevent text from wrapping, but still cut it off like an input does
+ white-space: nowrap;
+}
+
+// Make uneditable textareas behave like a textarea
+.uneditable-textarea {
+ width: auto;
+ height: auto;
+}
+
+
+// Placeholder
+// -------------------------
+
+// Placeholder text gets special styles; can't be bundled together though for some reason
+input,
+textarea {
+ .placeholder();
+}
+
// CHECKBOXES & RADIOS
// -------------------
@@ -250,6 +282,10 @@ textarea[class*="span"],
.input-append .uneditable-input[class*="span"],
.input-prepend input[class*="span"],
.input-prepend .uneditable-input[class*="span"],
+.row-fluid input[class*="span"],
+.row-fluid select[class*="span"],
+.row-fluid textarea[class*="span"],
+.row-fluid .uneditable-input[class*="span"],
.row-fluid .input-prepend [class*="span"],
.row-fluid .input-append [class*="span"] {
display: inline-block;
@@ -260,8 +296,18 @@ textarea[class*="span"],
// GRID SIZING FOR INPUTS
// ----------------------
+// Grid sizes
#grid > .input(@gridColumnWidth, @gridGutterWidth);
+// Control row for multiple inputs per line
+.controls-row {
+ .clearfix(); // Clear the float from controls
+}
+.controls-row [class*="span"] {
+ float: left; // Float to collapse white-space for proper grid alignment
+}
+
+
// DISABLED STATE
@@ -276,7 +322,6 @@ select[readonly],
textarea[readonly] {
cursor: not-allowed;
background-color: @inputDisabledBackground;
- border-color: #ddd;
}
// Explicitly reset the colors here
input[type="radio"][disabled],
@@ -332,19 +377,6 @@ select:focus:required:invalid {
.clearfix(); // Adding clearfix to allow for .pull-right button containers
}
-// For text that needs to appear as an input but should not be an input
-.uneditable-input {
- overflow: hidden; // prevent text from wrapping, but still cut it off like an input does
- white-space: nowrap;
- cursor: not-allowed;
- background-color: @inputBackground;
- border-color: #eee;
- .box-shadow(inset 0 1px 2px rgba(0,0,0,.025));
-}
-
-// Placeholder text gets special styles; can't be bundled together though for some reason
-.placeholder();
-
// HELP TEXT
@@ -352,7 +384,7 @@ select:focus:required:invalid {
.help-block,
.help-inline {
- color: @gray; // lighten the text some for contrast
+ color: lighten(@textColor, 15%); // lighten the text some for contrast
}
.help-block {
@@ -373,42 +405,44 @@ select:focus:required:invalid {
// ------------
// Allow us to put symbols and text within the input field for a cleaner look
-.input-prepend,
-.input-append {
+.input-append,
+.input-prepend {
margin-bottom: 5px;
+ font-size: 0;
+ white-space: nowrap; // Prevent span and input from separating
+
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;
- vertical-align: middle;
+ 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
&:focus {
z-index: 2;
}
}
- .uneditable-input {
- border-left-color: #ccc;
- }
.add-on {
display: inline-block;
width: auto;
height: @baseLineHeight;
min-width: 16px;
padding: 4px 5px;
+ font-size: @baseFontSize;
font-weight: normal;
line-height: @baseLineHeight;
text-align: center;
text-shadow: 0 1px 0 @white;
- vertical-align: middle;
background-color: @grayLighter;
border: 1px solid #ccc;
}
.add-on,
.btn {
margin-left: -1px;
+ vertical-align: top;
.border-radius(0);
}
.active {
@@ -432,10 +466,6 @@ select:focus:required:invalid {
.uneditable-input {
.border-radius(@inputBorderRadius 0 0 @inputBorderRadius);
}
- .uneditable-input {
- border-right-color: #ccc;
- border-left-color: #eee;
- }
.add-on:last-child,
.btn:last-child {
.border-radius(0 @inputBorderRadius @inputBorderRadius 0);
@@ -465,17 +495,36 @@ select:focus:required:invalid {
// SEARCH FORM
// -----------
-.search-query {
+input.search-query {
padding-right: 14px;
padding-right: 4px \9;
padding-left: 14px;
padding-left: 4px \9; /* IE7-8 doesn't have border-radius, so don't indent the padding */
- margin-bottom: 0; // remove the default margin on all inputs
- .border-radius(14px);
+ margin-bottom: 0; // Remove the default margin on all inputs
+ .border-radius(15px);
+}
+
+/* Allow for input prepend/append in search forms */
+.form-search .input-append .search-query,
+.form-search .input-prepend .search-query {
+ .border-radius(0); // Override due to specificity
+}
+.form-search .input-append .search-query {
+ .border-radius(14px 0 0 14px)
+}
+.form-search .input-append .btn {
+ .border-radius(0 14px 14px 0)
+}
+.form-search .input-prepend .search-query {
+ .border-radius(0 14px 14px 0)
+}
+.form-search .input-prepend .btn {
+ .border-radius(14px 0 0 14px)
}
+
// HORIZONTAL & VERTICAL FORMS
// ---------------------------
@@ -495,6 +544,7 @@ select:focus:required:invalid {
display: inline-block;
.ie7-inline-block();
margin-bottom: 0;
+ vertical-align: middle;
}
// Re-hide hidden elements due to specifity
.hide {
@@ -502,7 +552,9 @@ select:focus:required:invalid {
}
}
.form-search label,
-.form-inline label {
+.form-inline label,
+.form-search .btn-group,
+.form-inline .btn-group {
display: inline-block;
}
// Remove margin for input-prepend/-append