From 13bc74b636f4a9905010df84fc07790ccced0c93 Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Thu, 25 Jul 2013 18:29:51 -0700 Subject: Refactor forms styles * Reorganize forms.less * Change from attribute selectors to `.form-control`. Few lines, less specific (meaning easier overrides as `element[type=""]` is more specific than a class), less intrusive, and more performant. * Add `.form-group` for basic spacing in vertical forms. * Remove (unnecessary?) `margin: 0;` from `form` element (as far as I can tell no browser sets that anyway). --- dist/css/bootstrap.css | 182 ++++++++++++------------------------------------- 1 file changed, 44 insertions(+), 138 deletions(-) (limited to 'dist/css/bootstrap.css') diff --git a/dist/css/bootstrap.css b/dist/css/bootstrap.css index e187ec780..a3a2c3626 100644 --- a/dist/css/bootstrap.css +++ b/dist/css/bootstrap.css @@ -1274,10 +1274,6 @@ table th[class^="col-"] { border-color: #f8e5be; } -form { - margin: 0; -} - fieldset { padding: 0; margin: 0; @@ -1302,138 +1298,12 @@ label { font-weight: bold; } -select, -textarea, -input[type="text"], -input[type="password"], -input[type="datetime"], -input[type="datetime-local"], -input[type="date"], -input[type="month"], -input[type="time"], -input[type="week"], -input[type="number"], -input[type="email"], -input[type="url"], -input[type="search"], -input[type="tel"], -input[type="color"] { - display: block; - height: 38px; - padding: 8px 12px; - font-size: 14px; - line-height: 1.428571429; - color: #555555; - vertical-align: middle; - background-color: #ffffff; - border: 1px solid #cccccc; - border-radius: 4px; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); - -webkit-transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s; - transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s; -} - -select:focus, -textarea:focus, -input[type="text"]:focus, -input[type="password"]:focus, -input[type="datetime"]:focus, -input[type="datetime-local"]:focus, -input[type="date"]:focus, -input[type="month"]:focus, -input[type="time"]:focus, -input[type="week"]:focus, -input[type="number"]:focus, -input[type="email"]:focus, -input[type="url"]:focus, -input[type="search"]:focus, -input[type="tel"]:focus, -input[type="color"]:focus { - border-color: rgba(82, 168, 236, 0.8); - outline: 0; - -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6); - box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6); -} - -select[disabled], -textarea[disabled], -input[type="text"][disabled], -input[type="password"][disabled], -input[type="datetime"][disabled], -input[type="datetime-local"][disabled], -input[type="date"][disabled], -input[type="month"][disabled], -input[type="time"][disabled], -input[type="week"][disabled], -input[type="number"][disabled], -input[type="email"][disabled], -input[type="url"][disabled], -input[type="search"][disabled], -input[type="tel"][disabled], -input[type="color"][disabled], -select[readonly], -textarea[readonly], -input[type="text"][readonly], -input[type="password"][readonly], -input[type="datetime"][readonly], -input[type="datetime-local"][readonly], -input[type="date"][readonly], -input[type="month"][readonly], -input[type="time"][readonly], -input[type="week"][readonly], -input[type="number"][readonly], -input[type="email"][readonly], -input[type="url"][readonly], -input[type="search"][readonly], -input[type="tel"][readonly], -input[type="color"][readonly], -fieldset[disabled] select, -fieldset[disabled] textarea, -fieldset[disabled] input[type="text"], -fieldset[disabled] input[type="password"], -fieldset[disabled] input[type="datetime"], -fieldset[disabled] input[type="datetime-local"], -fieldset[disabled] input[type="date"], -fieldset[disabled] input[type="month"], -fieldset[disabled] input[type="time"], -fieldset[disabled] input[type="week"], -fieldset[disabled] input[type="number"], -fieldset[disabled] input[type="email"], -fieldset[disabled] input[type="url"], -fieldset[disabled] input[type="search"], -fieldset[disabled] input[type="tel"], -fieldset[disabled] input[type="color"] { - cursor: not-allowed; - background-color: #eeeeee; -} - -input, -select, -textarea { - width: 100%; -} - -input[type="file"], -input[type="image"], -input[type="submit"], -input[type="reset"], -input[type="button"], -input[type="radio"], -input[type="checkbox"] { - width: auto; -} - input[type="search"] { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } -textarea { - height: auto; -} - input[type="radio"], input[type="checkbox"] { margin: 4px 0 0; @@ -1471,26 +1341,62 @@ input[type="number"]::-webkit-inner-spin-button { height: auto; } -input:-moz-placeholder, -textarea:-moz-placeholder { +.form-control:-moz-placeholder { color: #999999; } -input::-moz-placeholder, -textarea::-moz-placeholder { +.form-control::-moz-placeholder { color: #999999; } -input:-ms-input-placeholder, -textarea:-ms-input-placeholder { +.form-control:-ms-input-placeholder { color: #999999; } -input::-webkit-input-placeholder, -textarea::-webkit-input-placeholder { +.form-control::-webkit-input-placeholder { color: #999999; } +.form-control { + display: block; + width: 100%; + height: 38px; + padding: 8px 12px; + font-size: 14px; + line-height: 1.428571429; + color: #555555; + vertical-align: middle; + background-color: #ffffff; + border: 1px solid #cccccc; + border-radius: 4px; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); + -webkit-transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s; + transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s; +} + +.form-control:focus { + border-color: rgba(82, 168, 236, 0.8); + outline: 0; + -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6); + box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6); +} + +.form-control[disabled], +.form-control[readonly], +fieldset[disabled] .form-control { + cursor: not-allowed; + background-color: #eeeeee; +} + +textarea.form-control { + height: auto; +} + +.form-group { + margin-bottom: 15px; +} + .radio, .checkbox { display: block; -- cgit v1.2.3 From 27cedf71d58e47c291b73e078adf939014dd838c Mon Sep 17 00:00:00 2001 From: Mark Otto Date: Thu, 25 Jul 2013 19:45:14 -0700 Subject: Update form validation states * Once again no longer applies to single inputs (this is a bit simpler, but I'm open to new ideas) but the entire set of inputs, labels, and help text within a particular element. However, the styles are not too dependent on markup or layout, so they're super flexible. * Simplified the markup in the validation docs examples to match latest changes. * Renamed `.form-state-validation` mixin to `.form-control-validation` to match naming of prev commit. --- dist/css/bootstrap.css | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'dist/css/bootstrap.css') diff --git a/dist/css/bootstrap.css b/dist/css/bootstrap.css index a3a2c3626..11339c516 100644 --- a/dist/css/bootstrap.css +++ b/dist/css/bootstrap.css @@ -1503,14 +1503,14 @@ select.input-small { color: #c09853; } -.has-warning .input-with-feedback { +.has-warning .form-control { padding-right: 32px; border-color: #c09853; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); } -.has-warning .input-with-feedback:focus { +.has-warning .form-control:focus { border-color: #a47e3c; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #dbc59e; box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #dbc59e; @@ -1527,14 +1527,14 @@ select.input-small { color: #b94a48; } -.has-error .input-with-feedback { +.has-error .form-control { padding-right: 32px; border-color: #b94a48; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); } -.has-error .input-with-feedback:focus { +.has-error .form-control:focus { border-color: #953b39; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #d59392; box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #d59392; @@ -1551,14 +1551,14 @@ select.input-small { color: #468847; } -.has-success .input-with-feedback { +.has-success .form-control { padding-right: 32px; border-color: #468847; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075); } -.has-success .input-with-feedback:focus { +.has-success .form-control:focus { border-color: #356635; -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #7aba7b; box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #7aba7b; -- cgit v1.2.3