snappymail/vendors/bootstrap/less/forms.less
2022-03-01 10:37:00 +01:00

189 lines
3.5 KiB
Text

//
// Forms
// --------------------------------------------------
// GENERAL STYLES
// --------------
// Make all forms have space below them
form {
margin: 0 0 @baseLineHeight;
}
// Identify controls by their labels
label {
display: block;
font-weight: normal;
line-height: @baseLineHeight;
margin-bottom: 5px;
}
// Set font for forms
button,
input,
optgroup,
select,
.select,
textarea {
font-family: inherit;
font-size: @baseFontSize;
line-height: @baseLineHeight;
margin: 0;
text-transform: none;
}
// Form controls
// -------------------------
// Shared size and type resets
select,
.select,
textarea,
input {
box-sizing: border-box;
display: inline-block;
padding: 4px 6px;
color: @gray;
border-radius: @inputBorderRadius;
}
textarea,
input {
background-color: @inputBackground;
border: 1px solid @inputBorder;
box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
transition: border linear .2s, box-shadow linear .2s;
width: 210px;
// Focus state
&:focus {
border-color: darken(@inputBorder, 20%);
box-shadow: none;
}
}
// Position radios and checkboxes better
input[type="radio"],
input[type="checkbox"] {
margin: 4px 0 0;
line-height: normal;
cursor: pointer;
}
// Reset width of input images, buttons, radios, checkboxes
input[type="file"],
input[type="radio"],
input[type="checkbox"] {
width: auto; // Override of generic input selector
}
// Make select elements obey height by applying a border
select, .select {
// Safari requires -webkit-
-webkit-appearance: none;
appearance: none;
background: @inputBackground url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' height='10px' width='15px'><text x='0' y='10' fill='rgb(85,85,85)'>▾</text></svg>") right center/1em no-repeat border-box;
border: 1px solid @inputBorder;
cursor: pointer;
padding-right: 1.5em;
width: 223px; // default input width + 10px of padding that doesn't get applied
}
// Focus for select, file, radio, and checkbox
select:focus,
.select:focus,
input[type="file"]:focus,
input[type="radio"]:focus,
input[type="checkbox"]:focus {
.tab-focus();
}
// INPUT SIZES
// -----------
// General classes for quick sizes
.input-xlarge { width: 270px; }
.input-xxlarge { width: 530px; }
// Grid style input sizes
input[class*="span"],
select[class*="span"],
textarea[class*="span"] {
margin-left: 0;
}
// DISABLED STATE
// --------------
// Disabled and read-only inputs
input[disabled],
select[disabled],
textarea[disabled],
input[readonly],
select[readonly],
textarea[readonly] {
cursor: not-allowed;
opacity: 0.7;
}
// FORM FIELD FEEDBACK STATES
// --------------------------
// Error
.control-group.error {
.formFieldState(@errorText, @errorText, @errorBackground);
}
// HORIZONTAL FORMS
// ---------------------------
// Common properties
// -----------------
.form-horizontal {
input,
textarea,
select {
display: inline-block;
margin-bottom: 0;
vertical-align: middle;
}
}
// Margin to space out fieldsets
.control-group {
margin-bottom: (@baseLineHeight / 2);
}
// Horizontal-specific styles
// --------------------------
.form-horizontal {
// Increase spacing between groups
.control-group {
margin-bottom: @baseLineHeight;
> label {
display: inline-block;
padding-top: 5px;
text-align: right;
width: 140px;
}
// Move over all input controls and content
> *:not(label) {
display: inline-block;
margin-left: 20px;
vertical-align: top;
}
}
}