Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Expandable Search Field
<div class="top-bar">
<div class="left">
<div class="right">
<form class="search-form">
<input type="text" name="search" placeholder="Search" />
.top-bar {
background: lightblue;
padding: 0.4rem;
.top-bar:before {
content: "";
display: table;
.top-bar:after {
content: "";
display: table;
.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
You can’t perform that action at this time.