You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

263 lines
5.3 KiB

10 years ago
@import "../mixins/index";
.reset-form();
label {
position: relative;
&[required]:before {
position: absolute;
display: inline-block;
left: ~"-5px \9"; // ie8-9
content: "*";
color: @label-required-color;
font-family: SimSun;
font-size: @font-size-base;
.translate3d(-10px; 0; 0);
}
> .@{iconfont-css-prefix} {
vertical-align: top;
font-size: @font-size-base;
}
10 years ago
}
// Form items
// You should wrap labels and controls in .@{css-prefix}form-item for optimum spacing
10 years ago
.@{css-prefix}form-item {
margin-bottom: @form-item-margin-bottom;
label {
color: @label-color;
text-align: right;
padding-right: 8px;
}
10 years ago
}
// Input styles
.@{css-prefix}input {
.input;
}
//== Input type: with extra icon
.has-feedback {
.input-with-icon();
}
//== Style for input-group
.@{css-prefix}input-group {
.input-group(~"@{css-prefix}input");
}
// 表单下的输入框尺寸唯一: 大尺寸
form {
.@{css-prefix}input {
height: @input-height-lg;
font-size: @font-size-base;
padding: @input-padding-horizontal;
}
.has-feedback {
.@{iconfont-css-prefix} {
.square(@input-height-lg);
line-height: @input-height-lg;
}
}
.@{css-prefix}input-group > .@{css-prefix}input,
.@{css-prefix}input-group > .@{css-prefix}input-group-addon,
.@{css-prefix}input-group > .@{css-prefix}input-group-btn > .input-btn {
height: @input-height-lg;
font-size: @font-size-base;
padding: @input-padding-horizontal;
}
// input[type=file]
.@{css-prefix}upload {
padding-top: 7px;
padding-bottom: 7px;
max-height: 32px;
font-size: @font-size-base;
}
}
10 years ago
// Radio & Checkbox
.@{css-prefix}radio,
.@{css-prefix}checkbox {
position: relative;
display: block;
margin-top: 10px;
margin-bottom: 10px;
height: @input-height-lg;
10 years ago
label {
min-height: @line-height-computed;
padding: 7px 0 7px 20px;
10 years ago
margin-bottom: 0;
font-weight: normal;
cursor: pointer;
}
}
.@{css-prefix}radio input[type="radio"],
.@{css-prefix}radio-inline input[type="radio"],
.@{css-prefix}checkbox input[type="checkbox"],
.@{css-prefix}checkbox-inline input[type="checkbox"] {
position: absolute;
margin-left: -20px;
margin-top: 4px \9;
}
.@{css-prefix}radio + .@{css-prefix}radio,
.@{css-prefix}checkbox + .@{css-prefix}checkbox {
margin-top: -5px;
10 years ago
}
// Radios and checkboxes on same line
.@{css-prefix}radio-inline,
.@{css-prefix}checkbox-inline {
position: relative;
display: inline-block;
padding: 7px 20px;
padding-right: 0!important;
10 years ago
margin-bottom: 0;
margin-right: 10px;
10 years ago
vertical-align: middle;
font-weight: normal;
cursor: pointer;
}
input[type="radio"],
input[type="checkbox"] {
&[disabled],
&.disabled,
fieldset[disabled] & {
cursor: @cursor-disabled;
}
}
// These classes are used directly on <label>s
.@{css-prefix}radio-inline,
.@{css-prefix}checkbox-inline {
&.disabled,
fieldset[disabled] & {
cursor: @cursor-disabled;
}
}
// These classes are used on elements with <label> descendants
.@{css-prefix}radio,
.@{css-prefix}checkbox {
&.disabled,
fieldset[disabled] & {
label {
cursor: @cursor-disabled;
}
}
}
10 years ago
// Form layout
//== Horizontal Form
.@{css-prefix}form-horizontal {
.@{css-prefix}form-item {
.make-row;
}
10 years ago
.@{css-prefix}radio,
.@{css-prefix}checkbox,
.@{css-prefix}radio-inline,
.@{css-prefix}checkbox-inline {
margin-top: 0;
margin-bottom: 0;
}
10 years ago
.@{css-prefix}radio,
.@{css-prefix}checkbox {
min-height: (@line-height-computed + (@input-padding-vertical-base + 1));
}
10 years ago
}
//== Inline Form
// Attention: Inline form does only apply to within viewports that are at least 768px wide
// TODO: 用 float 代替 inline-block
10 years ago
.@{css-prefix}form-inline {
&:extend(.clearfix all);
10 years ago
@media (min-width: @screen-sm-min) {
.@{css-prefix}form-item {
float: left;
10 years ago
margin-bottom: 0;
vertical-align: middle;
margin-right: 10px;
label {
padding-right: 0;
}
10 years ago
}
.@{css-prefix}input {
display: inline-block;
width: auto;
10 years ago
vertical-align: middle;
}
10 years ago
.@{css-prefix}form-text {
display: inline-block;
}
10 years ago
.has-feedback {
display: inline-block;
}
10 years ago
.@{css-prefix}radio,
.@{css-prefix}checkbox {
display: inline-block;
margin-top: 0;
margin-bottom: 0;
vertical-align: middle;
label {
padding-left: 0;
}
}
.@{css-prefix}radio input[type="radio"],
.@{css-prefix}checkbox input[type="checkbox"] {
position: relative;
margin-left: 0;
}
}
}
10 years ago
.@{css-prefix}form-horizontal, .@{css-prefix}form-inline {
label {
padding-top: 7px;
padding-bottom: 7px;
10 years ago
}
}
.@{css-prefix}form-text, .@{css-prefix}form-split {
10 years ago
// min-height: (@line-height-computed + @font-size-base);
margin: 0!important;
padding-top: 7px;
padding-bottom: 7px;
font-size: @font-size-base;
height: @input-height-lg;
}
10 years ago
.@{css-prefix}form-split {
text-align: center;
10 years ago
}
// Validation state
.has-success {
.form-control-validation(@success-color; @input-hover-border-color;);
.@{css-prefix}input {
border-color: @input-border-color;
}
10 years ago
}
.has-warning {
.form-control-validation(@warning-color; @warning-color;);
}
.has-error {
.form-control-validation(@error-color; @error-color;);
}
.@{css-prefix}form-explain {
display: block;
font-size: @font-size-base;
10 years ago
}