Advertisement

Subscribe For Free Updates!

We'll not spam mate! We promise.

Saturday, 18 January 2014

Add the New Google Style Search Bar to Blogger

Step 1. In Your (New Design) Blogger Dashboard Click the Drop Down Menu for Your Blog > Choose Template > Then Edit Html 
Step 2. Find the following piece of code in your blogs Html : (Click Ctrl and F for a search bar to help find the code - 
]]></b:skin>

Step 3. Copy and Paste the following code Directly Above / Before ]]></b:skin>




/*Start Css For Google Style Search Box*/

/* div container containing the form */
#searchContainer {
margin:20px;
}

/* Style the search input field. */
#field {
float:left;
width:200px;
height:27px;
line-height:27px;
text-indent:10px;
font-family:arial, sans-serif;
font-size:1em;
color:#333;
background: #fff;
border:solid 1px #d9d9d9;
border-top:solid 1px #c0c0c0;
border-right:none;
}

/* Style the "X" text button next to the search input field */
#delete {
float:left;
width:16px;
height:29px;
line-height:27px;
margin-right:15px;
padding:0 10px 0 10px;
font-family: "Lucida Sans", "Lucida Sans Unicode",sans-serif;
font-size:22px;
background: #fff;
border:solid 1px #d9d9d9;
border-top:solid 1px #c0c0c0;
border-left:none;
}
/* Set default state of "X" and hide it */
#delete #x {
color:#A1B9ED;
cursor:pointer;
display:none;
}
/* Set the hover state of "X" */
#delete #x:hover {
color:#36c;
}
/* Syle the search button. Settings of line-height, font-size, text-indent used to hide submit value in IE */
#submit {
cursor:pointer;
width:70px;
height: 31px;
line-height:0;
font-size:0;
text-indent:-999px;
color: transparent;
background: url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh56ibhSP9yKpDJQafEdzy4bmeRCQJW-yACUGfGrgNFp5aEw2we2h-jkm0f6rjLGGfDqAQlH8kjJ3nNU4UX_ekvNIDRICDMy_RidwHObomy4vqY1VSdPLLyn1wJmYe3uJbRyGTFFoKDYABu/s1600/ico-search.png) no-repeat #4d90fe center;
border: 1px solid #3079ED;
-moz-border-radius: 2px;
-webkit-border-radius: 2px;
}
/* Style the search button hover state */
#submit:hover {
background: url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh56ibhSP9yKpDJQafEdzy4bmeRCQJW-yACUGfGrgNFp5aEw2we2h-jkm0f6rjLGGfDqAQlH8kjJ3nNU4UX_ekvNIDRICDMy_RidwHObomy4vqY1VSdPLLyn1wJmYe3uJbRyGTFFoKDYABu/s1600/ico-search.png) no-repeat center #357AE8;
border: 1px solid #2F5BB7;
}
/* Clear floats */
.fclear {clear:both}

/*End Google Style Search Bar -  
http://thacyberlounge.blogspot.com/
Note - To change the width of the search bar simply change the line highlighted in yellow from 200px up or down.

Step 4. Find the following piece of code in your blogs Html : (Click Ctrl and F for a search bar to help find the code)

</head>
Step 5. Now Copy And Paste This Code Directly Above / Before </head>

Note - If you have previously added jQuery script to your template you can remove the code highlighted in green.
<script src='http://code.jquery.com/jquery-1.6.1.min.js' type='text/javascript'/>
<script type='text/javascript'>
$().ready(function() {
// if text input field value is not empty show the &quot;X&quot; button
$(&quot;#field&quot;).keyup(function() {
$(&quot;#x&quot;).fadeIn();
if ($.trim($(&quot;#field&quot;).val()) == &quot;&quot;) {
$(&quot;#x&quot;).fadeOut();
}
});
// on click of &quot;X&quot;, delete input field value and hide &quot;X&quot;
$(&quot;#x&quot;).click(function() {
$(&quot;#field&quot;).val(&quot;&quot;);
$(this).hide();
});
});
</script>

Step 6. Save your template, we have the Css added to style the search bar and the jQuery for the X button now we add the html.

Step 7. Head back to your blogs design page and click Add A Gadget > Choose Html/Javascript.
Step 8. Copy and Paste the following code into the Html/Javascript gadget :
<div id="searchContainer">
<form name="SUYB" action="/search" method="get">
<input type="text" id="field" id="s" name="q"/>
<div id="delete"><span id="x">x</span></div>
<input type="submit" name="submit" id="submit" value="Search" />
</form>
</div>
Step 9. Save the html/javascript gadget and you can drag and drop it into place.

And that is it! A lot of steps but over all I think it was easy enough to implement. Thanks once again to 
Queness for the original design

Drop Your Comments And Questions Below.

Share This If u Like It!!
SOCIALIZE IT →
FOLLOW US →
SHARE IT →
Bilal is a young Blogger, currently living in Kashmir, PAKISTAN. He is Founder & CEO of Tha Cyber Lounge. He is not a professional. But Still he can play with Blogger Template Codes, Web Developing, Graphic Designing, Html, Css, Jquery,logo Designing and Blogger Widgets. You can contact him at Facebook Or HIRE him BILAL To get latest updates. Tha Cyber Lounge

0 comments:

Post a Comment

Please Read The Rules Before Leaving a Comment:-

1.) Your feedback is always appreciated. We will try to reply to your queries as soon as time allows.

2.) Make sure to click the "Subscribe by email" link below the comment to be notified of follow up comments and replies.

3.) Please "Do Not Spam".

4.) Please "Do Not Add Links" to the body of your comment as they will not be published. If the queries contain link then never add HTML tag to it.

5.) Only "English" comments shall be approved and answered.

6.) Never Use Keywords In The Name Section Otherwise Your Comment Will Be Deleted.

7.) All comment will be deleted if it will not fulfill the requirements.