Skip to content

Instantly share code, notes, and snippets.

@mikeoberdick
Created May 7, 2016 16:53
Show Gist options
  • Save mikeoberdick/cddce1e1073e90c70e9ed3f6247669cd to your computer and use it in GitHub Desktop.
Save mikeoberdick/cddce1e1073e90c70e9ed3f6247669cd to your computer and use it in GitHub Desktop.
Expanding Search Form
.search-form {
position: absolute;
right: -50px;
top: 2px;
}
.search-form input[type="search"] {
background-color: transparent;
background-image: url(/wp-content/uploads/2016/03/search_icon.png);
background-position: 5px center;
background-repeat: no-repeat;
background-size: 24px 24px;
border: none;
cursor: pointer;
height: 40px;
position: relative;
-webkit-transition: width 400ms ease, background 400ms ease;
transition: width 400ms ease, background 400ms ease;
width: 0;
z-index: 100;
}
.search-form input[type="search"]:focus {
padding: 0 0 0 34px;
background-color: #fff;
border: 2px solid black;
cursor: text;
outline: 0;
/*width: 230px;*/
width: 300px;
}
.search-form input[type="submit"] {
display: none;
}
input[type="search"] {
-webkit-appearance: textfield;
}
.search-form {
overflow: hidden;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment