0
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-01-17 09:52:29 +01:00

add html5 invalid state for super fancy errors via browser

This commit is contained in:
Mark Otto 2012-01-07 04:28:30 -08:00
parent b6d50c892d
commit 7728f7b824
3 changed files with 25 additions and 1 deletions

12
bootstrap.css vendored
View File

@ -6,7 +6,7 @@
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Designed and built with all the love in the world @twitter by @mdo and @fat. * Designed and built with all the love in the world @twitter by @mdo and @fat.
* Date: Sat Jan 7 04:20:37 PST 2012 * Date: Sat Jan 7 04:26:09 PST 2012
*/ */
html, body { html, body {
margin: 0; margin: 0;
@ -824,6 +824,16 @@ textarea[readonly] {
background-color: #bcddbc; background-color: #bcddbc;
border-color: #468847; border-color: #468847;
} }
input:invalid, textarea:invalid, select:invalid {
color: #b94a48;
border-color: #ee5f5b;
}
input:invalid:focus, textarea:invalid:focus, select:invalid:focus {
border-color: #e9322d;
-webkit-box-shadow: 0 0 6px #f8b9b7;
-moz-box-shadow: 0 0 6px #f8b9b7;
box-shadow: 0 0 6px #f8b9b7;
}
.form-actions { .form-actions {
padding: 17px 20px 18px; padding: 17px 20px 18px;
margin-top: 18px; margin-top: 18px;

1
bootstrap.min.css vendored
View File

@ -155,6 +155,7 @@ input[disabled],select[disabled],textarea[disabled],input[readonly],select[reado
.control-group.success>label,.control-group.success .help-block,.control-group.success .help-inline{color:#468847;} .control-group.success>label,.control-group.success .help-block,.control-group.success .help-inline{color:#468847;}
.control-group.success input,.control-group.success textarea{color:#468847;border-color:#57a957;}.control-group.success input:focus,.control-group.success textarea:focus{border-color:#458845;-webkit-box-shadow:0 0 6px #9acc9a;-moz-box-shadow:0 0 6px #9acc9a;box-shadow:0 0 6px #9acc9a;} .control-group.success input,.control-group.success textarea{color:#468847;border-color:#57a957;}.control-group.success input:focus,.control-group.success textarea:focus{border-color:#458845;-webkit-box-shadow:0 0 6px #9acc9a;-moz-box-shadow:0 0 6px #9acc9a;box-shadow:0 0 6px #9acc9a;}
.control-group.success .input-prepend .add-on,.control-group.success .input-append .add-on{color:#468847;background-color:#bcddbc;border-color:#468847;} .control-group.success .input-prepend .add-on,.control-group.success .input-append .add-on{color:#468847;background-color:#bcddbc;border-color:#468847;}
input:invalid,textarea:invalid,select:invalid{color:#b94a48;border-color:#ee5f5b;}input:invalid:focus,textarea:invalid:focus,select:invalid:focus{border-color:#e9322d;-webkit-box-shadow:0 0 6px #f8b9b7;-moz-box-shadow:0 0 6px #f8b9b7;box-shadow:0 0 6px #f8b9b7;}
.form-actions{padding:17px 20px 18px;margin-top:18px;margin-bottom:18px;background-color:#f5f5f5;border-top:1px solid #ddd;} .form-actions{padding:17px 20px 18px;margin-top:18px;margin-bottom:18px;background-color:#f5f5f5;border-top:1px solid #ddd;}
.uneditable-input{display:block;background-color:#ffffff;border-color:#eee;-webkit-box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.025);-moz-box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.025);box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.025);cursor:not-allowed;} .uneditable-input{display:block;background-color:#ffffff;border-color:#eee;-webkit-box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.025);-moz-box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.025);box-shadow:inset 0 1px 2px rgba(0, 0, 0, 0.025);cursor:not-allowed;}
input:-moz-placeholder{color:#999999;} input:-moz-placeholder{color:#999999;}

View File

@ -299,6 +299,19 @@ textarea[readonly] {
.formFieldState(#468847, #57a957, lighten(#57a957, 30%)); .formFieldState(#468847, #57a957, lighten(#57a957, 30%));
} }
// HTML5 invalid states
// Shares styles with the .control-group.error above
input:invalid,
textarea:invalid,
select:invalid {
color: #b94a48;
border-color: #ee5f5b;
&:focus {
border-color: darken(#ee5f5b, 10%);
.box-shadow(0 0 6px lighten(#ee5f5b, 20%));
}
}
// FORM ACTIONS // FORM ACTIONS