Adding a Stylish Floating Search Box Widget in Blogger

floating search box
Search boxes are widely used by the visitors to search for the content what he/she needs. Adding a stylish search box will make the visitor more interested in searching for the content other than moving on to another bog for what they need.

What we have here is a simple floating search box which floats along the screen and expands while the visitor clicks on it. The widget wont affect the loading speed of your blog as CSS fixed property is used for making the widget float and no complex codes are used...

Adding Stylish Floating Search Box


Step 1: Move on to your Blogger Dashboard >> Layout >> Add Gadget:

Step 2: Choose HTML/JavaScript Gadget and add the below code into it.

<style type='text/css'>
/*<![CDATA[*/
#sbutton {
background: -moz-linear-gradient(center top , #4D90FE 0%, #4787ED 100%) repeat scroll 0pt 0pt transparent;background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#4d90fe), color-stop(100%,#4787ed));
background: -webkit-linear-gradient(top, #4d90fe 0%,#4787ed 100%);
background: -o-linear-gradient(top, #4d90fe 0%,#4787ed 100%);
background: -ms-linear-gradient(top, #4d90fe 0%,#4787ed 100%);
background: linear-gradient(top, #4d90fe 0%,#4787ed 100%);background-color: #4d90fe;
border: 1px solid #3079ED;
border-radius: 2px 2px 2px 2px;
color: #FFFFFF;
height: 27px;
min-width: 76px;
padding: 0 21px;padding-bottom: 2px;
}
#sbutton:hover{    background-color: #357AE8;
background-image: -moz-linear-gradient(center top , #4D90FE, #357AE8);background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#4d90fe), color-stop(100%,#357ae8));
background: -webkit-linear-gradient(top, #4d90fe 0%,#357ae8 100%);
background: -o-linear-gradient(top, #4d90fe 0%,#357ae8 100%);
background: -ms-linear-gradient(top, #4d90fe 0%,#357ae8 100%);
background: linear-gradient(top, #4d90fe 0%,#357ae8 100%);
border: 1px solid #2F5BB7;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);}
#simg {
background: url("https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh26SWuwMc0b-PYwvPQGyBKBOdjVbGx_ilHvlhkGPMeHNB2eWAeMtrW5LQ9jwoqHccZ6J6MQ6tojWrLatlvHYoCaIznIatJYnSXzBJjmTPY9dAGrd2YW1oFizLa6gS09Bl02m9vdYU2Gj37/s1600/searchicon.png") no-repeat scroll 0 0 transparent;
display: inline-block;
height: 14px;
margin: 0;
width: 17px;z-index:101;
}#s:hover {box-shadow: 0 1px 2px #C1C1C1 inset;}
#s {border: 1px solid #BCBCBC;border-radius: 4px 4px 4px 4px;font: italic 14px times New Roman;padding: 4px 2px;width: 146px; -moz-transition: width 0.2s ease-in 0s; -webkit-transition: width 0.2s ease-in; -o-transition: width 0.2s ease-in;}
#s:focus {width: 200px;}
.noop-searchbox {
display: block;
position: fixed;
right: 12px;
top: 1%;
max-width: 300px;min-width: 238px;
z-index: 100;
}
/*]]>*/
</style>
<div class='noop-searchbox' id='noop-searchbox'>
<form action='/search' id='noop-searchform' method='get'>
<input id='s' name='q' onblur='if (this.value == "") {this.value = "Search...";}' onfocus='if (this.value == "Search...") {this.value = ""}' type='text' value='Search...'/>
<button id='sbutton' type='submit'><span id='simg'></span></button>
</form></div>
Step 3: Now click the orange save button.

Customization

  • You can adjust the position of the search box by changing 12px & 1% with a suitable value.
That's it! Now reload your blog and you can see a cool floating search box on your blog. If you have faced any error while placing this widget then please share it with us through the comment box below. Other comments are also welcomed!

7 comments... add one

  1. How to keep the search box on the left side

    ReplyDelete
    Replies
    1. It's simple! Replace "right: 12px;" with "left:12px;" in the above code. Peace!

      Delete
  2. how to fix it at the top ? and make it fixed there even while scrolling ..... ?

    ReplyDelete
    Replies
    1. Search for : position : fixed ; and delete it.

      Delete
  3. thnx bro

    Download Totally Free Full Version Software,Full PC Games ,Movies,Crack,Activator,Hack and More

    http://rwebking.blogspot.in/

    ReplyDelete
  4. how to keep it on menu bar and make it stick with top of the screen when scroll down???please reply

    ReplyDelete