A Pen by Joey Hayes on CodePen.
Created
September 13, 2015 22:49
-
-
Save joeyred/a4f0d228ed460643bd0e to your computer and use it in GitHub Desktop.
Expandable Search Field
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="top-bar"> | |
<div class="left"> | |
</div> | |
<div class="right"> | |
<form class="search-form"> | |
<input type="text" name="search" placeholder="Search" /> | |
</form> | |
</div> | |
</div> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.top-bar { | |
background: lightblue; | |
padding: 0.4rem; | |
} | |
.top-bar:before { | |
content: ""; | |
display: table; | |
} | |
.top-bar:after { | |
content: ""; | |
display: table; | |
clear:both; | |
} | |
.search-form { | |
float: right; | |
} | |
.search-form input[name="search"] { | |
border-radius: 0.3rem; | |
border: 1px solid #aaa; | |
padding: 0.5rem 0.4rem; | |
font-size: 1.1rem; | |
width: 180px; | |
transition: width 0.3s ease-in-out; | |
} | |
.search-form input[name="search"]:focus { | |
width: 300px; | |
outline: 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment