Skip to content

Instantly share code, notes, and snippets.

Created June 28, 2015 02:02
Show Gist options
  • Save anonymous/19c7c42aa91ba1540b3e to your computer and use it in GitHub Desktop.
Save anonymous/19c7c42aa91ba1540b3e to your computer and use it in GitHub Desktop.
CSS-Tricks Almanac – :disabled
<form action="#">
<label for="name">Enabled Input:</label>
<input type="text" autofocus>
<hr>
<label for="name">Disabled Input:</label>
<input type="text" disabled>
</form>
/* The good stuff starts here :)
*/
input {
width: 60%;
margin: 0;
border: none;
outline: 1px solid lightgrey;
outline-offset: 2px;
}
input:disabled {
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAAIklEQVQIW2NkQAKrVq36zwjjgzhhYWGMYAEYB8RmROaABADeOQ8CXl/xfgAAAABJRU5ErkJggg==) repeat;
}
/* BASIC PAGE CSS. NOT PART OF THE EXAMPLE
*/
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
body {
font: 300 16px/1.25 "Helvetica Neue", sans-serif;
color: #708090;
background: cornflowerblue;
padding: 1.5em;
}
form {
background: whitesmoke;
padding: 1.5em;
max-width: 400px;
width: 100%;
outline: 3px solid rgba(0, 0, 0, 0.25);
}
hr {
visibility: hidden;
}
label {
margin-right: 3%;
text-align: left;
display: inline-block;
width: 35%;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment