<h1>Animated Search Bar</h1>
<div id="wrap">
  <button type="submit">
    <i class="fa fa-search"></i>
  </button>
  <input type="text" placeholder="Search...">
</div>
html, body {
  font-family: 'Teko';
  height: 100%;
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  text-shadow: 2px 2px 2px rgb(0, 0, 0, 0.3);
}

body {
  background: linear-gradient(90deg, #a4a9f4 0%, #8362d2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  color: #fff;
  font-size: 50px;
  font-weight: 400;
}

*, *:before, *:after { box-sizing: inherit; }

#wrap {
  position: relative;
  height: 72px;
}

input {
  height: 72px;
  display: block;
  width: 0px;
  background: none;
  transition: all 0.5s cubic-bezier(1, -0.35, 0.62, 1.35);
  cursor: pointer;
  border: 4px solid #fff;
  cursor: pointer;
  padding: 0 55px 0 15px;
  font-size: 40px;
  color: #FFF;
  text-shadow: 2px 2px 2px rgb(0, 0, 0, 0.3);
  outline: 0;
  font-family: 'Teko';
}

input::placeholder {
  color: #fff;
}

input:focus, button:focus + input {
  padding: 0 75px 0 15px;
  width: 500px;
  z-index: 1;
  cursor: text;
  height: 72px;

}

button {
  width: 78px;
  bottom: 0;
  text-align: center;
  color: #fff;
  cursor: pointer;
  font-size: 40px;
  position: absolute;
  top: 0;
  right: 0;
  background: #9385e3;
  outline: 0;
  border: 4px solid;
  padding: 0;
}

h1 {
  margin: 0;
  font-size: 1.23em;
}

External CSS

  1. https://fonts.googleapis.com/css?family=Teko:300,400,500,600,700
  2. https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css

External JavaScript

This Pen doesn't use any external JavaScript resources.