Skip to content

Instantly share code, notes, and snippets.

@akdetrick
Created April 3, 2012 22:33
Show Gist options
  • Save akdetrick/2296002 to your computer and use it in GitHub Desktop.
Save akdetrick/2296002 to your computer and use it in GitHub Desktop.
focus states
/**
* Focus states
* applies box shadow in normal state;
* declares transition for any border & box shadow changes (set below in focus)
*/
input, textarea {
/*transition*/
-webkit-transition: border linear 0.1s, box-shadow linear 0.2s;
-moz-transition: border linear 0.1s, box-shadow linear 0.2s;
-ms-transition: border linear 0.1s, box-shadow linear 0.2s;
-o-transition: border linear 0.1s, box-shadow linear 0.2s;
transition: border linear 0.1s, box-shadow linear 0.2s;
/*default state*/
-webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
-moz-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
/*focus border & outline*/ }
input:focus, textarea:focus {
outline: 0;
border-color: #3987cb;
-webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.333), 0 0 6px rgba(57, 135, 203, 0.5);
-moz-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.333), 0 0 6px rgba(57, 135, 203, 0.5);
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.333), 0 0 6px rgba(57, 135, 203, 0.5); }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment