Add banner, Adsense or search box in header
A reader asked me how to add a search box on the right of blog title. I thought I’d share my answer in this post.
Actually, you can add anything inside your header -be it an ad banner, a search bar, social media buttons, Adsense ad or just about any widget you can get your hands on. But how?
By simply adding a new section in the header. A section functions as widget container and is represented by a dashed-lined box in the Layout and usually comes with an Add A Gadget link thingy. Once you get the Add A Gadget added in there, the rest is easy.
(Update: There is another way to Add widgets next to Blogger header, check it out.)
Here we go:
1. Adding a section (in HTML)
- Login to your Blogger account.
- Go to Template > Edit HTML.
- Back up your template.
- Make sure the Expand Widget Templates checkbox is UNCHECKED.
- Look for the following lines in your HTML code:
<b:section class='header' id='header' maxwidgets='1' showaddelement='no'> <b:widget id='Header1' locked='true' title='My Test Blog (Header)' type='Header'/> </b:section>
- To add a section, insert the following code right under (after) it:
<b:section id='header-right' showaddelement='yes'/> <div style='clear: both;'/>
- So the final code should look like this:
<b:section class='header' id='header' maxwidgets='1' showaddelement='no'> <b:widget id='Header1' locked='true' title='Blogger Sentral Widget Showcase (Header)' type='Header'/> </b:section> <b:section id='header-right' showaddelement='yes'/> <div style='clear: both;'/>
You now have two sections in the header, the section with the existing blog title on top and the new section below it.
2. Styling the section (in CSS)
Position the sections side by side, by floating the section containing the blog title to the left, and the new section to the right.
To achieve that,
- Locate this line of code (you are still on Template > Edit HTML page):
]]></b:skin>
- Add the following CSS code right before (on top of) the line.
#header, body#layout #header {width:50%;display:inline-block;float:left;} #header-right, body#layout #header-right {width:35%;display:inline-block;float:right;padding:15px;} #header-right .widget {margin:0;}
3. Installing the widget
Now it is time to add the banner, search box, Adsense ad unit or whatever. Do as you’d normally do when you want to install a widget,
- Go to Layout page.
- Click the new Add A Gadget link and add your widget.
Note: The header wireframes may not appear side by side for Designer templates, nevertheless they should show up just fine on your blog. - Save and view your blog.
4. Fine-adjusting the position
If the added widget shows up under the blog title (instead of on the same level, on it’s right), go back to the CSS code in step 2.2.
Change header(code line 1) and header-right (code line 2) widths. Experiment with different values until you get it right.
Enjoy!
263 comments to "Add banner, Adsense or search box in header"
«Oldest ‹Older 201 – 263 of 263 Newer› Newest»Thanks! Great Instructions!
I've been struggling a lot to add a banner to my blog header, and with your great tutorial i've been able to do it in just a couple of minutes. This is a great article, and it deserves a google+ !
please help! i have been messing around with mine for hours now, and read EVERY comment to try to fix it. I am looking to have the header and adsense share the space. it keeps staying below. thanks!
howikeepsane.blogspot.com
@Janean
It looks like you've figured it out :)
Greenlava, forgive me if I comment too long here. But your tutorial opens my eyes in a simple but enlightening way.
I spent two hours alone and forgot working on my tasks just to practice this. Repeatedly I employed the code and CSS and changed my blog template the as all my efforts were failed. And eventually I knew what's wrong with my steps. Guess what:
Step No. 4 Make sure the Expand Widget Templates checkbox is UNTICKED. U-N-T-I-C-K-E-D.
As a total newbie, I used to leave the three or four first steps in tutorials unread as they are usually 'standard': back up your template etc. But because of your present tutorial, I know now that I shouldn't have. :)
Once I edited the HTML again, this time the expand widget UNTICKED, A Gadget is ready to use although in blogger's new interface it is still under the blog title.
I haven't yet time to work on my blog 'cause I need refreshing after so many foolish reading of mine. :D
Thx,Greenlava.
PS: In case you want to check, my blog is newphonetracker.blogspot.com
such a great info n wat a nice follow up. terima kasih [ thank you]. (^^)
Thanks a lot! after some minor tweak I was able to place it right.
Thanks It worked for me
How I can remove navibar from my blogger. any body can help me right now.
@Live stream 24/7
Visit How to remove or restore Blogger navbar
I have used this in my blog and I was successful. Thanks
wazz up there...thanks
Thanks mate! That was very helpful.
its a problem of the new blogger template we cannot divide the header section into 2.NO blog expert can do as of now even my master blogger
Dear Greenlava,
I've tried everything I could to make this widget work, but I couldn't. I'm not the best at all these code-thing, but I understand things. However, when I put this code (exactly like how you wrote in the tutorial) to its place, blogger didn't let me save it. I really want to put something (actually a photo) to my blog. That's the situation: http://tinypic.com/r/13z95bc/5
Could you help me?
Lili
@Lili
What is your blog URL?
Does this work with the new version of simple template for blogger? I want an ad and a pic in my header. Thanks for letting me know if its worth continuing on this I've tried for an hour! My blog is www.itsoverflowing.com THnaks, Aimee
@Aimee - ItsOverflowing.com
Maybe you would want to try another, easier way:
Adding widgets on both sides of Blogger header
wow! Thank you so much! it is working on my blog now. I've been looking to so many website but didn't help me because the tuts are very long and so confusing. Yours is very short and precise and not hard to follow. You can check my blog and see how it looks. hehehe.. Thanks so much and more power to you!!
Thank you kindly! This works great~ And the fine-tuning was easy enough to do~ :3 Thanks again for the tutorial!
Hi. How can I divide header into more than 2 parts? Thanks
@Sandister Tei
Folow this tutorial: Adding widgets on both sides of Blogger header
Not working for me, showing the right hand widget below the header widget.
www.ssbcrack.com
regards
@Vande Mataram
I looks fine to me. I guess you've fixed it.
Wow nice tutorial, thank you so much, it worked for me..
my banner is going below title.....tried to play with width but no luck
sorry..i forgot to give my blog name in last comment its....
damn-topics.blogspot.com
sir..can you please help me to solve the problem..i am not able to add new widget side by side..it's coming below title,i experimented with width values but no success..:(
Hi Greenlava,
I'm having trouble adjusting the banner inside of my header. I added an html ad there and when I try to adjust the width it doesn't move. I'd like it to be in the top right corner of my banner. Can you let me know what I need to fix or if I installed it correctly? Here's my blog http://odara112.blogspot.com/ Thanks so much
@ODARA
You have a broken CSS code due to a missing closing curly bracket. Fix this first.
Find this:
.post img {
padding:4px;
border: none;
.post blockquote {
margin:1em 20px;
}
and replace it with this:
.post img {
padding:4px;
border: none;
}
.post blockquote {
margin:1em 20px;
}
That fixed it!! Thank you so much ^_^ !!
thanks for this info. I wonder why blogger has restricted so many things. Are they trying to push us back to the advent of designing your website yourself before you can make a living out of the internet
Thank-you so much ^_^. This was very easy to follow. Though finding the </b:section part was a bit difficult since my header code was a lot bigger.
Hallo i have tried it again and now it works ;D
Ty for your helpful tutorials, you helped me in so many cases
TY i like your blog ;)
Best Regards
Hello, I have a question. If i wanted to add another widget inside my header how would I do that? Do i just duplicate the code? Here's my blog http://www.gimmethatglow.com/ I want to add a widget right underneath the "subscribe" area inside the header. I tried just adding the code underneath the ad but nothing happens.
@ODARA
Try this method:
Adding widgets on both sides of Blogger header
Thanks!!
Hello Greenlava,
I am trying to place two widgets in the blogger header. one left to the header image and the other to right. ie, widgetLeft : HeaderImg : widgetRight
Everything looks fine in all the browsers otherthan IE, where the widgets are coming vertically under the headerImg one after tha other.I tried a lots of options adjusting the widths and going thru lots of sites like you mentioned in #240.. but no luck. If would be great if you could take a look.
http://smart-buddy.blogspot.com/
@unnama
Try another method, see reply #240.
Thanks a lot for the code.. i got mine work fine after reading the whole tutorials + comments..
took me like 1 hour or so q.q
www.khaiangel.com
Thanks for share easy tutorial. i will try now in my blog.I all ready subscribed me in your blog for subscribe. Hope you continue posting such good tutorials.
Adjusting 2.2 Code has done the Trick :) thanks for the awesome tutorial exactly what i was looking :)
thanks for your tutorial..
Great ! Thanks a lot
I was exactly looking for this. Finally found this. Now i can easily add a search box in the space created
I was exactly looking for this thank you
awesome, thank you very much!
thanks & super for your tips
I've been looking all over for a instructions on how to do this. Thank you so much! Very helpful.
thanks for sharing! great tutorials!
Awsome thank you so much, i have been looking for this for a long time thank you again and wish you all the best :)
I PUT IT IN MY BLOG AND IT'S WORKING NICE.
Thanks a lot for this tutorial,
But I have a problem in my layout. In my header i can see " add a gadget" tab but I lost my " header title gadget " from my layout.
Thanks a lot!
Thanks a lot.. it's work.. done!.. i just change..
#header-right, body#layout #header-right
width to 470px and padding to 7px.. fits with my page header.
Your blog is a number 1 place to find anything related to blogging. You are just awesome man..@!!
hi bro,
I tried to install the widget, but the right header section comes below the title image.
try byk kali uboh padding, do jadi jugok. lagu mano nih?
tolong skit
http://ohmysukan.blogspot.com/
@encikarman
Kecilkan skit lebar #header tu, cuba try test tengok width:45% jadi ko dok. Kalu tok jadi kkecik skit lagi.
Sir i follow your instructions 100% but still banner is showing below the blog title . i also change header widths but nothing happens . please tell me any other method to fix it .
Thank you so much for another awesome tutorial, Greenlava! Worked like a charm for me. I've split my header into 2 sections and I'm extremely joyous and grateful for your help.
One question though... how to add a gadget container ABOVE the blog's header? You have a tutorial for a section below the header but none (am I right?) for the section above. Any help will be very appreciated. God bless!
I tried this and it worked great!! i have NO knowledge of HTML codes but this was a great tutorial. I even worked out how to move it more to the right with altering the width.
The only thing i found hard was finding the area of html where i needed to enter the code.
A quick google search told me to hit command F and enter it into the box.
Thanks for our hard work!
Thank You so much! I successfully managed to put a search bos on the left side of my blog. To put the box lower than the original position I just used
tags.
Thi was the only method that I found which worked. Thank you. Now I have put a search box in the header of my blog. It adds to attractiveness and also saves space for other widgets! :)
Thank you so much dear :-)
thanks for the info it helps
Comments on this post are closed.