JSFiddle - React, Tailwind, and code Playground
HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>CSS3 search thingy - by Creppe</title>
</head>
<body>
<div id="wrap">
<h2>Inset shadows</h2>
<div>
<input id="search1" placeholder="Search" type="text"/>
</div>
<div>
<input id="search2" type="text"/>
</div>
<h2>"Normal" shadows</h2>
<div>
<input id="search3" class="normalShadow" placeholder="Search" type="text"/>
</div>
<div>
<input id="search4" class="normalShadow" type="text"/>
</div>
</div>
</body>
</html>
CSS
/*
CSS3 search thingy - by Creppe
*/
/*
Background image made simply in photoshop by adding monochrome noise to a dark color.
Or just.. You know, save the imgur version.
*/
body {
background: url(http://i.imgur.com/3OdOq.jpg) repeat;
}
h2 {
font: 24px trebuchet ms, arial;
}
#wrap {
width: 400px;
margin: 50px auto;
padding: 30px;
background: rgba(155,155,155,0.35);
border-radius: 5px;
}
#wrap div {
margin: 10px auto;
}
/*
Magnifying glass icon part of the awesome Sweetie Plus icon set.
http://sublink.ca/icons/sweetieplus/
*/
input {
/*
RGBA is RGB colors with an alpha channel.
It's for setting the opacity. 0.5 = 50% opacity
*/
background: url(http://i.imgur.com/8aJBI.png) left center no-repeat rgba(255,255,255,0.5);
border-radius: 3px;
border: none;
color: #fff;
text-shadow: 0 1px 0 #666;
/*
TWANSITIONS
For that web "two point oh" feel.
*/
transition: all 0.3s;
-moz-transition: all 0.3s;
-webkit-transition: all 0.3s;
-o-transition: all 0.3s;
/*
Box shadow
*/
box-shadow: inset 1px 1px 3px #333, inset -1px -1px 3px #333;
}
#search1, #search3 {
height: 25px;
width: 45px;
padding: 5px 4px 5px 35px;
}
#search2, #search4 {
height: 25px;
width: 25px;
padding: 5px;
text-indent: 30px;
}
input:focus {
width: 150px !important;
}
.normalShadow {
box-shadow: 1px 1px 3px #333, -1px -1px 3px #333;
}