Creating an apple style search box.

Apple style search box....

Ever wanted to create one of those neat look search boxes that used to be found on apples website ?? Well here’s the HTML & CSS code to create just the thing. Note that with search boxes you can change the action=”http://www.duckduckgo.com/search“ to any search engine you like. I’ve chosen to use Duckduckgo because that’s my search engine of choice.

[ NOTE THE “FORM” & “INPUT” HTML WAS NOT SHOWING CORRECTLY SO I HAD TO ENTER A SPACE AT THE START AFTER “<”. PLEASE REMOVE THIS SPACE BEFORE USING THIS CODE ]

HTML

< form method="get" action="http://www.duckduckgo.com/search" id="search" target="_blank">
< input name="q" type="text" size="40" placeholder="Search..." />

CSS

#search input[type="text"] {
background-color; #87afc7;
border: 0 none;
font-family: 'Ubuntu Mono', monospace;
color: #222222;
width: 400px;
padding: 6px 15px 6px 35px;
-webkit-border-radius: 20px;
-moz-border-radius: 20px;
border-radius: 20px;
text-shadow: 0 2px 2px rgba(0, 0, 0, 0.3);
-webkit-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 3px rgba(0, 0, 0, 0.2) inset;
-moz-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 3px rgba(0, 0, 0, 0.2) inset;
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 3px rgba(0, 0, 0, 0.2) inset;
-webkit-transition: all 0.7s ease 0s;
-moz-transition: all 0.7s ease 0s;
-o-transition: all 0.7s ease 0s;
transition: all 0.7s ease 0s;
}
 
#search input[type="text"]:focus {
width: 400px;
}

Related posts