Home All Posts Lijit Search

If you are new to Blogger Sentral, you may want to subscribe to our RSS feed or get the latest articles sent to your Email.

For questions or post-unspecific comments please use the questions/comments gadget on the right sidebar.


Creating navigation or menu tabs in Blogger

July 04, 2009
navigation bar tabs

A typical navigation bar/tabs

A navigation or menu bar is a bar made up of tabs. “Behind” those tabs are links -to internal pages, other web sites etc. Making navigation tabs is not that difficult. They are basically links with some styling added for visual appeal. While links are arranged vertically, navigation tabs are usually arranged horizontally. (If you come here looking for dropdown menu, then read Installing a multi level CSS dropdown menu).

In this tutorial we will install the bar just below the header, a typical place for navigation bar. The bar will be added as a gadget via Page Elements page. The advantage of using a gadget is that if you want to remove it later on, it can be done easily without editing the HTML.

But in order to do that, the template must have a page element (to contain the gadget) at that particular location –below the header. In Minima template (the template I’m using to test this project) as with most other templates, the is no such element. What do we do then? We create it.

 

page element 1

No element to add in the widget/gadget

 

Step 1. Adding a Page Element

Adding a page element is done in the HTML.

  1. Go to Dashboard>Layout>Edit HTML.
  2. Back up your template.
  3. Look for the following lines (or something similar) in your HTML codes:
    <div id='header-wrapper'>
    <b:section class='header' id='header' maxwidgets='1' showaddelement='no'>
    <b:widget id='Header1' locked='true' title=Your Blog Title(Header)' type='Header'/>
    </b:section>
    </div>
  4. Right under it, paste this code:
    <!--Navigation page element starts -->
    <div id='navibar-wrapper'> 
    <b:section class='navibar' id='navibar' showaddelement='yes'/> 
    </div> 
    <div style='clear: both;'/>
    <!--Navigation page element ends -->
    page element 2

Step 2. Adding in the tabs

  1. Go to Layout>Page Elements sub tab.
  2. Click Add-A-Gadget link below the header.
  3. Scroll down the Add-A-Gadget window and select HTML/Javascript.
  4. Leave the title box empty.
  5. Copy and paste the HTML code below.
    <!-- Navigation tabs start -->
    <a href="YourLink1" class="navitabs" title="TooltipText1">ButtonText1</a>
    <a href="YourLink2" class="navitabs" title="TooltipText2">ButtonText2</a>
    <a href="YourLink3" class="navitabs" title="TooltipText3">ButtonText3</a>
    <a href="YourLink1" class="navitabs" title="TooltipText4">ButtonText4</a>
    <a href="YourLink5" class="navitabs" title="TooltipText5">ButtonText5</a>
    <!-- Navigation tabs end -->
  6. Replace YourLink with the url of each link, TooltipText with the text you want to appear when you hover the button and ButtonText with the text you want show on each button.
  7. Click Save. page element 3
    navigation tabs
    A working navigation tabs, before styling

 

Step 3. Styling the tabs.

Copy the code below and paste it into the CSS section of your template. (CSS stands for Cascading Style Sheet. It is a segment in your template code that is responsible for styling your page. It starts from <b:skin><![CDATA[ and ends with ]]></b:skin>).

/* Navigation tabs start */
a.navitabs, a.navitabs:link, a.navitabs:visited {display:block; width:150px; height:25px; background:wheat; border:1px solid black; margin-top:2px; text-align:center; text-decoration:none; font-family:verdana, arial, sans-serif; font-size:12px; color:black; line-height:25px; overflow:hidden; float:left;}
a.navitabs:hover {color:white; background:olive;}
a.navitabs:active {color:white; background:indianred;}
/* Navigation tabs end */ 
navigation tabs

The finished product

 

Step 4. Customizing

  • Change the colors, height etc. to suit your taste.
  • You can add or reduce the number of tabs. To add, go to Step 2 and add in the links.
  • Change the width of the tabs in Step 3 until they align nicely with your blog header.
  • You can move the bar to the top of the header if you want,
    1. In Step 1 no.3, inside the header widget, change locked='true' to locked='false'.
    2. Drag & drop the bar element in Page Elements page.

That’s all and good luck.

 

Before you leave:
  • Do you find this article useful? Share it via Tweet This or Add This buttons below.
  • Any suggestion, question or comment? Please post it in the comments below.
Technorati Tags:

70 comments to "Creating navigation or menu tabs in Blogger"

Werner von Wallenrod July 6, 2009 6:03 PM  

A couple of your tips (this one, the one about changing the color of your comments text), say to "copy the code below and paste it into the CSS section of your template."

Does that mean just anywhere in the Edit Template HTML box?

Werner von Wallenrod July 6, 2009 7:09 PM  

I also have a problem with the text from the last button appearing on the line underneath the buttons when viewing the page in IE (but not FireFox) after following these instructions.
Interestingly, that text disappears if you highlight the button (but reappears again right after). Any idea what this could be?

Greenlava July 6, 2009 7:40 PM  

CSS (Cascading style sheet) starts from:
< b:skin >< ![CDATA[
and ends with:
]]>< /b:skin >

you will notice the similarities in syntax with the code I've given.

Greenlava July 6, 2009 8:13 PM  

Ahh..just as you're about to scream "I did it!", along comes every webmaster's nightmare -IE :).
I don't really know what's causing this problem, but try changing the tab width to 130px, that will remove it.

Werner von Wallenrod July 6, 2009 8:22 PM  

"Ahh..just as you're about to scream "I did it!", along comes every webmaster's nightmare -IE :)."


LOL Exactly!
Thanks for both answers. Gonna try resizing the tabs now. 8)

Werner von Wallenrod July 6, 2009 9:11 PM  

Resizing worked. :)

By the way, after I resized it to 130, the buttons were (naturally) noticeably smaller, and worse: bunched over to one side with an obvious gap on the other side. So I played with the sizes, and found 137 was the highest I could go without having the "spill over" problem. And that looked much less crappy.

Now, I'm still using the default blogger column widths (I haven't resized them like Greenlava shows you how to do in another post), so if anyone else reading this is having the same issue, 137 might be your magic number. :)

Thanks again!

Greenlava July 6, 2009 9:41 PM  

I thought I typed 137px...Need to remind myself -Proof-read before posting.

Dumb Status July 18, 2009 4:16 PM  

Hey! Everything worked great but I was wondering if there was a way to add dropdowns to these?

Greenlava July 19, 2009 10:11 PM  

Hi Dumb Status,
Dropdown menus are a bit different. Better build anew. This is on project list too.
But for the time being you can go to CSSPlay. They have all sorts of menus there.

Katie McFarlan July 26, 2009 1:33 AM  

I used your code but for some reason, when I click on the links on the menu bar, rather than going directly to the URL, they go to www.halfwaytohousewife.blogspot.com/www.halfwaytohousewife.blogspot.com rather than just www.halfwaytohousewife.blogspot.com

Can you offer any suggestions?

Greenlava July 26, 2009 2:19 AM  

Katie,
You omitted http://. To correct it, use this:
http://www.halfwaytohousewife.blogspot.com.
One more thing I notice your header is slightly misaligned. To correct it, set margin to 0px in #header.

tanweer,  July 26, 2009 3:36 PM  

thanks greenlave,
a question is, as we done above, how can one link to that nav. buttons (if suppose external link then ok but) within same blog how can we link to that nav. buttons we just created?
and how can we create the other page to be display on click nav. buttons.
plz clarify about both points.
thanks in advance.

melody July 26, 2009 3:50 PM  

thanks greenlava,
(1)after creating nav.buttons how can we link them in the same blog. (ok for external link we can change in href but what about inside link)
(2)and to that link how/where will we creat the linked pages . lol

thanks in advance.

Greenlava July 26, 2009 5:54 PM  

@Katie,
You're welcome. Come back anytime.

@tanweer, melody,
1. To get the link to an internal(post) page. Click the post title to display only that post. Then look inside your browser address bar, that's the post link/address. You use that link in the nav. tab.
2. Create a page first, then link to it. Not the other way around. In Blogger (post) pages are created automatically when you publish a new post.

melody July 26, 2009 8:17 PM  

sory greenlava, first it seems that there is error in posting comment, later i observed that both the comment gt posted.
thanks for your kind cooperation.

Profile August 5, 2009 1:01 PM  

greenlava,
what should i do so that
instead of wheate color an small image will appear in that block and another image for mouse rollover (instead of indianred color)
i can upload images for that on other domains.
thanks in advance.

Greenlava August 5, 2009 8:06 PM  

Put an id in each of your link code, like this
< a href="YourLink1" id="navitab1" class="navitabs" title="TooltipText1" >ButtonText1< /a >

then define the background for each id in CSS:

#navitab1 {background:url(Link_To_Navitab1-Image;}
#navitab1:hover{background:url(Link_To_Navitab1-Hover_Image;}

Do this for all tabs.

mike s. August 13, 2009 12:12 AM  

hi green lava,
for step 3, i have to copy the codes into which part of the template? i cannot find the (CSS) in my template.

Greenlava August 13, 2009 12:25 AM  

Hi mike s.,
Please refer to comment#3.
Paste it immediately before ]]>< /b:skin > line.

Mama Snow August 14, 2009 4:49 AM  

I am so close to getting this done, except.... I paste step 3 in my CSS and I loose my side bars and everything moves to left, causing my whole blog to be off center.

I see the buttons and they link too, but it is just text and smooshed. Help. By the way I love all the tips you put on your site.

Mama Snow August 14, 2009 4:55 AM  

So I posted this towards the end of my CSS like you said to mike above, but when I change the width and color, nothing happens. Here is my blog so you can see how it looks. Can you be more specific on what to change in the HTML to make my buttons appear in a box with a background color, etc. Sorry I am not the best with HTML.

Greenlava August 14, 2009 10:09 PM  

Hi Mama Snow,
Welcome to my blog :)
I think I know what the problem is. You have this near the end of your CSS:
.numberingcomments{
float: right;
display: block;
width: 50px;
margin-right: 5px;
margin-top: -35px; /*comments-counter position*/
text-align: right;
font-family: 'Century Gothic','Lucida Grande',Arial,Helvetica,Sans-Serif;
font-size: 30px;
font-weight: normal;
a:link, .numberingcomments a:visited {color: #445566 !important; text-decoration: none !important;
a:hover, .numberingcomments a:active {color: #FF9933 !important; text-decoration: none !important;
}

You left out two closing curly braces "}". The first one is for .numberingcomments and the second one is for a:link...
Just insert the curly braces.
When you are done with that, add in the codes for the navigation tabs at the end of CSS...and you'll be all right.

Mama Snow August 15, 2009 4:08 AM  

I am still struggling. I see what you mean. I do not have a brace by the a:link. I think I have one before numbering comments though. I tries it and it still isn't doing much.
I think I am just more visual. Could you show me above where they go exactly.

Here is what I have as of now...

}
.numberingcomments{
float: right;
display: block;
width: 50px;
margin-right: 5px;
margin-top: -35px; /*comments-counter position*/
text-align: right;
font-family: 'Century Gothic','Lucida Grande',Arial,Helvetica,Sans-Serif;
font-size: 30px;
font-weight: normal;
a:link, .numberingcomments a:visited {color: #445566 !important; text-decoration: none !important;
a:hover, .numberingcomments a:active {color: #FF9933 !important; text-decoration: none !important;
}
/* Navigation tabs start */
a.navitabs, a.navitabs:link, a.navitabs:visited {display:block; width:150px; height:25px; background:wheat; border:1px solid black; margin-top:2px; text-align:center; text-decoration:none; font-family:verdana, arial, sans-serif; font-size:12px; color:black; line-height:25px; overflow:hidden; float:left;}
a.navitabs:hover {color:white; background:olive;}
a.navitabs:active {color:white; background:indianred;}
/* Navigation tabs end */


Thanks so much.

Greenlava August 15, 2009 8:41 PM  

Mama Snow,
It's like this:
.numberingcomments { float: right; bla bla bla font-weight: normal; <--- NG
.numberingcomments { float: right; bla bla bla font-weight: normal; } <--- Good, with a closing curly

a:link, .numberingcomments a:visited { color: #445566 bla bla bla !important <--- NG
a:link, .numberingcomments a:visited { color: #445566 bla bla bla !important } <--- Good, with a closing curly

Momma Morgan September 16, 2009 9:18 PM  

Thank you so much for this Greenlava. I plan on revamping my blog and stumbled upon this post today and it really broke the process down in a great way.

I do have a question though. I have seen navigation bars on which if you place your mouse over a tab, more tab options drop down. I was wondering if you know how to do that?

mustbedgy September 20, 2009 8:00 AM  

hey greenlava !!!

marvelous.. i luv my new menu... i tried it on a bogus blog before applying on mine.... marvelous !!!
thank you, thank you

my only question is similar to the one of katie and tanweer:
let's say that i have tab name "fashion" in my menu. And let's say i have 5 posts that i want people to see when they click on the "fashion" tab, do i have to put the link for each post under the tab ? (a coma between each , indefenetely) isnt there a faster way to do this because if ihave 1000 posts , i will have to put 1000 links in the html code ?

thank you in advance !!!

Greenlava September 22, 2009 11:51 PM  

mustbedgy,
All you have to do is label each post (in post editor) with the word "fashion". Then, under "fashion" tab put the the link to that label: http://YourBlogName.blogspot.com/search/label/fashion

graceonline September 27, 2009 9:11 AM  

Thank you so much for providing this information. I'm using it on a new blog I'm building, using a heavily customized template. So far, I'm only getting a text link. The buttons are not showing. Below is the code I'm using. I've altered the text colors to match my blog links, but left your background colors for now.

You are providing a wonderful service. Thank you!


/* Navigation tabs start */
a.navitabs, a.navitabs:link, a.navitabs:visited {display:block; width:150px; height:25px; background:wheat; border:1px solid black; margin-top:2px; text-align:center; text-decoration:none; font-family:verdana, arial, sans-serif; font-size:12px; color:#5588aa; line-height:25px; overflow:hidden; float:left;}
a.navitabs:hover {color:#006699; background:olive;}
a.navitabs:active {color:#5588aa; background:indianred;}
/* Navigation tabs end */

Greenlava September 27, 2009 10:52 AM  

graceonline,
I can't check out your blog (set to private)so I'm guessing here.
Maybe to forgot to include the class attribute (class="navitabs") in the links HTML in Step 2.

☼¨`*•.♥Rocío♥.•*¨`☼ September 30, 2009 8:03 AM  

I want to thank you so much for your AWESOME tutorials. You have help me a bunch!
I AM STUCK!
I want to stylish my bar but I don't understand part 3. I try to place it on EDIT HTML but it gives me an error.
can you help me? I try to understand the answers you gave the others but no help!
Thank you in advance for taking the time to help me!!!

Greenlava September 30, 2009 3:35 PM  

Rocio,
Copy the code in Step 3 and paste it immediately before
]]>< /b:skin > line
in your Layout>Edit HTML page.

Tamara October 1, 2009 11:28 PM  

THANK YOU GREENLAVA


answered my question (mustbedgy) pretty well

thank you again

Rainbow Coloured Shadow October 1, 2009 11:34 PM  

Hi there,

Your site is fabulous and darn side more helpful than Blogger discussion forum. I am trying to build the navigation buttons you describe and am half way and everything is going smoothly, but I don't know where the CSS section of the template is? Please could you give me detailed instructions on how to find or do this. I have never coded a thing in my life so have followed your instructions by the letter, but the CSS letters are still not something I understand.

Greenlava October 1, 2009 11:49 PM  

@Tamara,
You're welcome.

@Rainbow Coloured Shadow,
Thanks, please read comment #34.

Rainbow Coloured Shadow October 2, 2009 12:48 AM  

Thanks for the speedy response. I tried that. Now my buttons are in a line underneath each other and have no boxes. Am I doing something wrong? I assume that there is a "}" after the 150px.

My site is rainbowcolouredshadow.com.

Also how do I change the colours. I see the steps you have listed and will try that as soon as I have the boxes working, but how do I know the names of my blog colours when the colour tab just gives me a reference number rather than a colour name. Can I insert the colour numbers where you have the colour names or is there a way to find the name of the colours I have selected so that the buttons match the colours of my blog?

Greenlava October 2, 2009 11:18 AM  

Rainbow Coloured Shadow,
I think I know the problem. You copied the code when my page wasn't completely loaded into your computer. Any way this is the complete code:
/* Navigation tabs start */
a.navitabs, a.navitabs:link, a.navitabs:visited {display:block; width:150px; height:25px; background:wheat; border:1px solid black; margin-top:2px; text-align:center; text-decoration:none; font-family:verdana, arial, sans-serif; font-size:12px; color:black; line-height:25px; overflow:hidden; float:left;}
a.navitabs:hover {color:white; background:olive;}
a.navitabs:active {color:white; background:indianred;}
/* Navigation tabs end */

Yes you can use Color hex code instead of Colornames.
To find a hex code of any color, I use colorpicker from http://www.allgraphicstools.com/

BG,  October 2, 2009 2:12 PM  

Greenlava,
I'm having problem to add second tier to my existing menu tab. Can you give me the right code to add in as second line? You may check my menu tab at www.beautygalleries.blogspot.com. Thank you.

SL,  October 2, 2009 3:40 PM  

Greenlava,
Thank you for your tutorial it is really helpful. Now, I have another problem. I just want to add one additional layer of dropdown under text button 1 that only show when the mouse point at the button. Can you give me the code? Thank you.

Linn Marie Hansen October 4, 2009 3:59 AM  

Hi. I was just wondering. I did everything you wrote, but the tabs won't align with the content wrapper, and they're pushed all over to the left. Do you know if i did something wrong or something to help?

graceonline October 4, 2009 7:49 AM  

Thank you for getting back to me about the issues I was having (comments #31 & #32). You are so kind to check each of our comments and blogs. I'm not ready to publish yet, so the blog is not up for viewing. I apologize for any inconvenience that may have caused you.

I had copied your code exactly, so class was not the issue, but I had added a note, beginning with the greater-than, exclamation point, dash-dash; and ending with dash-dash, greater-than sign, as follows:

9/26/09: To add navigation tabs just under header, added the "navigation element code" (far above) and navigation tabs code immediately above, per advice of Blogger Central at http://bloggersentral.blogspot.com/2009/07/creating-navigation-tab-in-blogger.html.

Today, I moved the note BELOW the new code and the problem disappeared. Don't know why that should make a difference, but it did.

Thanks again for all the good you are doing for us. I'll twitter this page later today.

Rainbow Coloured Shadow October 4, 2009 9:36 PM  

How do I create a navigation tab similar to what you have on this site with the Home and All Posts so that blogger does not put up the label vs all posts flag, but that it is a permanent feature such as you have on your absolutely helpful blog site?
Rainbowcolouredshadow.com

Greenlava October 5, 2009 12:34 AM  

@BG and SL,
My latest post is about dropdown menu, check it out.
@Linn Marie Hansen,
Please add this line in CSS:
#navibar-wrapper {margin: 0 auto; width:950px;}
@graceonline,
Can't say what the problem is since I could not view your blog, anyway glad your solved it.
@Rainbow Coloured Shadow,
I answered it in replying to your comment in the other post.

Program Sukarelawan Teknologi (PROSTEC) October 7, 2009 12:23 AM  

Greenlava, i'm having problem when applying this method..
can u help me..
i'm really not sure about the part that needs to add the code..

when i'm trying to put the code, it says an error..

Greenlava October 7, 2009 12:43 AM  

Program Sukarelawan Teknologi (PROSTEC),
I see you've added the HTML part (step 2).
To add the CSS code in step 3, you need to find /b:skin in your template code. Then add in the CSS code right before the line.

Greenlava October 7, 2009 1:11 AM  

Program Sukarelawan Teknologi (PROSTEC),
The code for button color is background:wheat. Replace wheat with your own colorname. You can find a list of colornames here

Greenlava October 7, 2009 7:33 PM  

Program Sukarelawan Teknologi (PROSTEC,
The easiest way to do that is by using image as a button.
To make smooth cornered buttons, go to GRSites. Then download the button into your pc, after that upload the image to image host such as Photobucket or Flickr. Once uploaded, get the link to the image and use it in the background code (the code in comment no.49).
To learn how to use images as background, read Using image as background.

Program Sukarelawan Teknologi (PROSTEC) October 8, 2009 8:36 AM  

for example, if i only put 3 button below my header..
can i move all the button to the center?

Greenlava October 8, 2009 1:35 PM  

Program Sukarelawan Teknologi (PROSTEC),
Yes you can. Add this line:
#navibar-wrapper {margin: 0 auto; width:592px;}
where the width must equal the sum of all tab widths (plus margins).

☼¨`*•.♥Rocío♥.•*¨`☼ October 14, 2009 11:30 PM  

Thank you so much for the tutorial!
Now I have an another question: do you have a tutorial or a code on how to apply a navigation tabs but with pictures and a scroll down options like the one from "MckMama"<--click to see her navigation bar to see what I mean.
Thank you so much for all your help!
Have a Lovely♥Day!
~Rocío a.k.a."Mamí♥Picture"

Greenlava October 15, 2009 2:34 PM  

☼¨`*•.♥Rocío♥.•*¨`☼,
Welcome back :), that's a dropdown menu. Read Installing a multi level CSS dropdown menu.
To replace tab text with a photo just replace (in the HTML code) the word with an image code, you know the img src="http://blahblahblah thing.

April Ficek October 22, 2009 7:47 AM  

I loved this post. I found I easily put in my nav bar. It was refreshing for it to be so simple. The great thing I found too is if you change template then this formatting ends up being another sidebar, which is great! So then I followed your steps again to put in a nav bar and now I have a nav bar and another sidebar.
Thank you
April Ficek

If you drink coffee. Learn how you can improve your health one sip at a time.
http://www.livetothemaxblog.com/2009/10/do-you-drink-coffee-then-try-cup-of.html

Website: http://aprilficek.organogold.com/na/biz/

HillBillyFilly October 28, 2009 12:19 AM  

I am having a problem with my youtube video feed widget. Everytime I change something in the title of a video-this punk rock group intermintently puts inself in place of the specified video. This has happened many times.I have done everything I know to stop this. Here is a new page I am making http://bartlettobit.blogspot.com/

The intruders youtube name is KakashiMr
The title comes up as undefined intruder when it knocks my James Dean Video off Bloggersentral is a great site that I have gotten many tips from. My main site is http://bartletttexas.blogspot.com/ which I am still working on. Email me at lanahill@att.net

Greenlava October 28, 2009 2:31 AM  

HillBillyFilly,
View my answer in the Any question/comment? gadget in the right sidebar.

HillBillyFilly October 28, 2009 5:29 AM  

Thanks for the answer & your time GreenLava, but it didn't really solve the problem as I would like. Yes I am aware of how to embed a youtube video and have done some both ways(widget & embed)

Yes I did just want that one James Dean video to load as I thought it good to put on my Obit page. The keywords I used should bring that one video in exclusively. And did and does on others till I go back and change the title or something, and then here comes the same guys with the same videos--no matter what the keywords. They did it on a Shirley Temple--they have skulls & punk. It's some type of security breach, and it almost has to be being perpetuated by them. I did a malware check on my computer & the program did find 1 malicious, and removed it. Thought that solved my problem but it did not. I guess I will have to report to Google & YouTube. If anyone knows anything let me hear from you. lanahill@att.net http://bartletttexas.blogspot.com/
Thanks Much

Jon October 29, 2009 4:11 AM  

When I insert the styling code, it styles the tabs fine but changes the background of the entire blog to white. What do i do to keep it black?

Greenlava October 29, 2009 4:13 PM  

Jon,
1. Make sure you copy the full code. Do this by hovering the code, clicking View Source and select all in the source code window.
2. Paste the code immediately before ]]>< /b:skin > line.

Cara Powers October 31, 2009 1:41 AM  

I'm trying to change the font to Verdana Bold and to remove the space between your navbar hack and my header; I'm unsuccessful so far. Help?

http://oohbooks.blogspot.com

melandria November 10, 2009 12:24 AM  

thanks i did it but still in the process of customizing it. thanks a lot.

Now it's your turn to say something

Reciprocals

Add to Technorati Favorites Bloggers & Blogging Blogs - Blog Catalog Blog Directory BlogKelate BlogMalaysia.com Kelantan Bloggers
Himpunan Blog Malaysia Blog Kita All Malaysian Bloggers Project Blogged.my

Privacy Policy

  ©The Professional Template by Ourblogtemplates.com 2008 Tuned by GreenLava

Blog Widget by LinkWithin