<!-- Font Awesome -->
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">
<!-- Roboto Webfont -->
<link href='https://fonts.googleapis.com/css?family=Roboto:300' rel='stylesheet' type='text/css'>
<!-- Search Link -->
<a href="#search">
<i class="fa fa-search"></i> Search
</a>
<!-- Search Form -->
<div id="search">
<span class="close">X</span>
<form role="search" id="searchform" action="/search" method="get">
<input value="" name="q" type="search" placeholder="type to search"/>
</form>
</div>
/* Basic Style */
body{
font-size: 20px;
font-family: Roboto;
font-weight: 300;
}
a{
color: #FC2121;
text-decoration: none;
border: 4px solid #FC2121;
padding: 10px 15px;
line-height: 3;
transition: all .3s ease;
transition: all .3s ease;
transition: all .3s ease;
transition: all .3s ease;
transition: all .3s ease;
}
a:hover{
color: #FFF;
background: #FC2121;
transition: all .3s ease;
transition: all .3s ease;
transition: all .3s ease;
transition: all .3s ease;
transition: all .3s ease;
}
/* Search Style */
#search {
position: fixed;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.7);
transition: all 0.5s ease-in-out;
transition: all 0.5s ease-in-out;
transition: all 0.5s ease-in-out;
transition: all 0.5s ease-in-out;
transition: all 0.5s ease-in-out;
transform: translate(0px, -100%) scale(0, 0);
transform: translate(0px, -100%) scale(0, 0);
transform: translate(0px, -100%) scale(0, 0);
transform: translate(0px, -100%) scale(0, 0);
transform: translate(0px, -100%) scale(0, 0);
opacity: 0;
display: none;
}
#search.open {
transform: translate(0px, 0px) scale(1, 1);
transform: translate(0px, 0px) scale(1, 1);
transform: translate(0px, 0px) scale(1, 1);
transform: translate(0px, 0px) scale(1, 1);
transform: translate(0px, 0px) scale(1, 1);
opacity: 1;
z-index: 106;
display: block;
}
#search input[type="search"] {
position: absolute;
top: 50%;
left: 0;
margin-top: -51px;
width: 60%;
margin-left: 20%;
color: rgb(255, 255, 255);
background: transparent;
border-top: 1px solid rgba(255, 255, 255, .8);
border-bottom: 2px solid rgba(255, 255, 255, .5);
border-left: 0px solid transparent;
border-right: 0px solid transparent;
font-size: 40px;
font-family: Roboto;
font-weight: 300;
text-align: center;
outline: none;
padding: 10px;
}
#search .close {
position: fixed;
top: 15px;
right: 15px;
opacity: 1;
font-size: 27px;
color: #fff;
}
#search .close:hover{
color: #FC2121;
cursor: pointer;
}
$(document).ready(function(){
$('a[href="#search"]').on('click', function(event) {
$('#search').addClass('open');
$('#search > form > input[type="search"]').focus();
});
$('#search, #search button.close').on('click keyup', function(event) {
if (event.target == this || event.target.className == 'close' || event.keyCode == 27) {
$(this).removeClass('open');
}
});
});
This Pen doesn't use any external CSS resources.