HTML Code:
- On the page load input box will show text “Search….”
- Clicking on input box will call javascript event “onfocus” and it will clear text “Search….”
- Leaving input box will call javascript event “onblure” and it will add text “Search…” if the value for input box is “NULL”
CSS Code:
body{ margin: 0px auto; padding: 10px; width:275px; font-family: verdana;}
.searchDiv
{
border: 1px solid #888;
padding:3px 5px;
display: inline-block;
background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#eee));
background: -moz-liner-gradient(top, #fff, #eee);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#eeeeee'); /* IE 7*/
-ms-filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#eeeeee'); /* IE 8*/
border-radius: 2em;
-webkit-border-radius: 2em;
-moz-border-radius: 2em;
box-shadow: inset 0 1px 0px rgba(0,0,0,.2);
-webkit-box-shadow: inset 0 1px 0px rgba(0,0,0,.2);
-moz-box.shadow: inset 0 1px 0px rgba(0,0,0,.2);
}
.searchBox
{
border-radius: 2em;
-webkit-border-radius: 2em;
-moz-border-radius: 2em;
outline: none;
padding:5px 10px;
width: 200px;
border: 1px solid #888;
color: #666;
font-size: 12px;
box-shadow: inset 0 1px 2px rgba(0,0,0,.2);
-webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,.2);
-moz-box.shadow: inset 0 1px 2px rgba(0,0,0,.2);
}
.searchButton
{
border-radius: 2em;
-webkit-border-radius: 2em;
-moz-border-radius: 2em;
outline: none;
padding:5px;
color: white;
background-color:#666;
font-weight:bold;
font-size: 12px;
border: 1px solid #888;
}
.searchButtonImage
{
background: url(search.png) no-repeat;
border:none;
height:24px;
width:24px;
}