1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-30 08:39:56 +02:00

improve code quality on custom forms

This commit is contained in:
Mark Otto
2014-12-25 15:40:24 -08:00
parent dacac2ab72
commit b92534c632
9 changed files with 277 additions and 415 deletions

View File

@@ -1887,7 +1887,6 @@ legend {
label {
display: inline-block;
margin-bottom: 5px;
font-weight: bold;
}
input[type="search"] {
@@ -3019,7 +3018,6 @@ input[type="submit"].btn-block, input[type="reset"].btn-block, input[type="butto
position: relative;
display: inline;
padding-left: 1.5rem;
font-weight: normal;
color: #555;
cursor: pointer;
}
@@ -3027,7 +3025,6 @@ input[type="submit"].btn-block, input[type="reset"].btn-block, input[type="butto
position: absolute;
z-index: -1;
opacity: 0;
/* Put the input behind the label so it doesn't overlay text */
}
.c-input > input:focus ~ .c-indicator {
-webkit-box-shadow: 0 0 0 .075rem #fff, 0 0 0 .2rem #0074d9;
@@ -3059,7 +3056,7 @@ input[type="submit"].btn-block, input[type="reset"].btn-block, input[type="butto
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
user-select: none;
background-color: #eee;
background-repeat: no-repeat;
background-position: center center;
@@ -3081,7 +3078,6 @@ input[type="submit"].btn-block, input[type="reset"].btn-block, input[type="butto
background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxNy4xLjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DQo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgOCA4IiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCA4IDgiIHhtbDpzcGFjZT0icHJlc2VydmUiPg0KPHBhdGggZmlsbD0iI0ZGRkZGRiIgZD0iTTQsMUMyLjMsMSwxLDIuMywxLDRzMS4zLDMsMywzczMtMS4zLDMtM1M1LjcsMSw0LDF6Ii8+DQo8L3N2Zz4NCg==);
}
/* Alternately, use another character */
.control-x input:checked ~ .control-indicator {
background-image: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxNy4xLjAsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DQo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB3aWR0aD0iOHB4IiBoZWlnaHQ9IjhweCIgdmlld0JveD0iMCAwIDggOCIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwIDAgOCA4IiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxwYXRoIGZpbGw9IiNGRkZGRkYiIGQ9Ik0xLjQsMEwwLDEuNGwwLjcsMC43bDEuOCwxLjhMMC43LDUuN0wwLDYuNGwxLjQsMS40bDAuNy0wLjdsMS44LTEuOGwxLjgsMS44bDAuNywwLjdsMS40LTEuNEw3LjEsNS43DQoJTDUuMywzLjlsMS44LTEuOGwwLjctMC43TDYuNCwwTDUuNywwLjdMMy45LDIuNUwyLjEsMC43QzIuMSwwLjcsMS40LDAsMS40LDB6Ii8+DQo8L3N2Zz4NCg==);
}
@@ -3095,23 +3091,19 @@ input[type="submit"].btn-block, input[type="reset"].btn-block, input[type="butto
}
.c-inputs-stacked .c-input:after {
display: block;
margin-bottom: .25rem;
margin-bottom: .25rem;
content: "";
}
.c-inputs-stacked .c-input + .c-input {
margin-left: 0;
}
/*
* Select
*/
.select {
position: relative;
display: inline-block;
color: #555;
}
.select select {
.select > select {
display: inline-block;
width: 100%;
-webkit-appearance: none;
@@ -3125,17 +3117,23 @@ input[type="submit"].btn-block, input[type="reset"].btn-block, input[type="butto
border-radius: .25rem;
outline: 0;
-moz-appearance: none;
appearance: none;
}
/* Undo the Firefox inner focus ring */
.select select:focus:-moz-focusring {
.select > select:focus {
-webkit-box-shadow: 0 0 0 .075rem #fff, 0 0 0 .2rem #0074d9;
box-shadow: 0 0 0 .075rem #fff, 0 0 0 .2rem #0074d9;
}
.select > select:focus:-moz-focusring {
color: transparent;
text-shadow: 0 0 0 #000;
}
/* Dropdown arrow */
.select > select:active {
color: #fff;
background-color: #0074d9;
}
.select > select::-ms-expand {
display: none;
}
.select:after {
position: absolute;
top: 50%;
@@ -3152,37 +3150,11 @@ input[type="submit"].btn-block, input[type="reset"].btn-block, input[type="butto
border-left: .35rem solid transparent;
}
/* Hover state */
/* Uncomment if you need it, but be aware of the sticky iOS states.
.select select:hover {
background-color: #ddd;
}
*/
/* Focus */
.select select:focus {
-webkit-box-shadow: 0 0 0 .075rem #fff, 0 0 0 .2rem #0074d9;
box-shadow: 0 0 0 .075rem #fff, 0 0 0 .2rem #0074d9;
}
/* Active/open */
.select select:active {
color: #fff;
background-color: #0074d9;
}
/* Hide the arrow in IE10 and up */
.select select::-ms-expand {
display: none;
}
/* Media query to target Firefox only */
@-moz-document url-prefix() {
/* Firefox hack to hide the arrow */
/* <option> elements inherit styles from <select>, so reset them. */
.select select {
padding-right: 1rem;
padding-right: 1rem;
text-indent: .01px;
text-overflow: '';
text-overflow: "";
}
.select option {
@@ -3190,7 +3162,6 @@ input[type="submit"].btn-block, input[type="reset"].btn-block, input[type="butto
}
}
/* IE9 hack to hide the arrow */
@media screen and (min-width: 0\0) {
.select select {
z-index: 1;
@@ -3219,13 +3190,10 @@ input[type="submit"].btn-block, input[type="reset"].btn-block, input[type="butto
}
}
/*
* File
*/
.file {
position: relative;
display: inline-block;
height: 2.5rem;
height: 2.5rem;
cursor: pointer;
}
@@ -3249,7 +3217,7 @@ input[type="submit"].btn-block, input[type="reset"].btn-block, input[type="butto
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
user-select: none;
background-color: #fff;
border: .075rem solid #ddd;
border-radius: .25rem;
@@ -3278,40 +3246,11 @@ input[type="submit"].btn-block, input[type="reset"].btn-block, input[type="butto
border-radius: 0 .25rem .25rem 0;
}
/* Focus */
.file input:focus ~ .file-custom {
-webkit-box-shadow: 0 0 0 .075rem #fff, 0 0 0 .2rem #0074d9;
box-shadow: 0 0 0 .075rem #fff, 0 0 0 .2rem #0074d9;
}
/*
* Control layouts
*/
.controls-stacked {
margin: 1rem 0;
}
.controls-stacked .control, .controls-stacked .progress {
display: block;
}
.controls-stacked .control + .control, .controls-stacked .progress + .progress {
margin-top: .5rem;
}
.controls-inline {
margin: 1rem 0;
}
.controls-inline .control {
display: inline-block;
height: 1rem;
}
.controls-inline .control + .control {
margin-left: 1rem;
}
.nav {
margin-bottom: 0;
}