How to add a navigation bar

Today i will show you how to add navigation links just below your blogs header like mine above and it depends what template you are using but it will fit most so always use a test blog before you apply it to your current blog as I'm not responsible if you mess your template up and there is lots of different styles you could have but I'm going to show you how to add a simple set of navigation links so first we need to copy the following CSS code



/* navigation links css code
----------------------------------------------- */
#topnav {
height:40px;
}
#topnav ul {
float:left;
width:100%;
padding:0;
margin:0;
list-style-type:none;
}
#topnav a {
padding:3px 7px 3px 7px;
float:left;
text-decoration:none;
color:#000;
margin:9px 10px 0 0;
}
#topnav a:hover {
color:#666;
}
#topnav li {
display:inline
}


Now paste it like i have done just below the closing skin tag



Now you need to copy the following XHTML code changing the red parts to where ever you are pointing your links to. The first part with the / points to your blogs homepage



<div id='topnav'>
<ul>
<li><a href='/'>Home</a></li>
<li><a href='#'>Contact</a></li>
<li><a href='#'>Link 3</a></li>
<li><a href='#'>Link 4</a></li>
</ul>
</div>


and paste it just below the header closing div tag like I've done below




now if you preview your template you should see some links just below your blogs header like mine below



you can change parts of the CSS code to make different navigation styles you should make a test blog and play around with the CSS code to see what you can come up with this is just a simple one

21 Responses to “How to add a navigation bar”

aksn1p3r said...

I seriously admire your efforts, not many people go the extra mile to css their layouts. I will be using some of your icons and tips in future.

Thank you!

Terrah Dawn said...

Very useful information - this is exactly what I've been searching for.
I used your method and it works great!

Only question left: How does one get a background for this? I've tried different ideas to get a background for mine and I can't. I notice you have a red one to match your blog title.

Anonymous said...

Thank you this was very helpful.

Anonymous said...

thank you for the wonderful tutorial. i'd like to say that all i know of CSS and XHTML, i've learned here :)
but i'm curious...how do we add links to the tabs we've just created?

Baji said...

Thank you for sharing how to get the nav bar up...now how ca I get that to be that when i click on one of the nav bar links ; ie Contact me, that it will go to that page?

www.womenvoters2008.blogspot.com

Anonymous said...

How a bout adding links blend into the Header image??

R.J. said...

For some reason my navigation links are appearing below the fold. Plus their stacked vertically rather then horizontally.

I'm currently using a 3-column Scribe template for the new Blogger.

Lawny said...

r.j you may have some other CSS rules overriding the one's i gave in the tutorial what is the url of the site you are trying to apply them to ? i need more details.

Hi .. that helped a lot. I'm very new to blogging though and now that I have the links up, they are there, but how do I get them to go to where I want them to go? If you click on it, it goes nowhere (of course I haven't told it how) but you left me hangin :)

Lawny said...

@janaMarie
change the red # to the url you would like to point to for example

<li><a href='http://www.google.com'>google</a></li>

Ah I got it.. Now I have another question. It worked (THANK YOU) but the text is black and so is my background. Is there a way to change the color? Or put a light strip underneath the text? Also, is there a way to put it above my header?

You rock!

lil.D said...

very helpful !! thanks a lot

turbocharger1 said...

thanks so much you explained everything so well!!!
i tried doing this with someone elses site explaining, but it didnt work but then i came here and you explained it heaps better than everyone elses site i saw

Chocolate said...

This wasn't too difficult and it looks great on my site! Just what I needed! Thanks!
http://howtomakeeasycash.blogspot.com

Halim said...

Your instruction is effective. However would you tell please how to change the navbar background colour?

Halim
http://cellphonecentre.blogspot.com

Lawny said...

@Halim
if you are using the codes shown it the tutorial add a background rule to the CSS as shown

#topnav {
height:40px;
background:#f00;
}

in the CSS above i have set the background colour to a red colour change the hex code to whatever colour you want here's a link to some hex colour codes to get you started

Halim said...

Hi, Lawny thanks for your prompt reply and I already changed the color by following you. Can you do one more thing for me. How to omit the extra space between below the header and up of menu bar from my below blog?

http://wirelessphonereviews.blogspot.com

Halim said...

Thanks Lawny I am glad to get your prompt reply. I am sorry that I am bothering you aagin

Lawny said...

@Halim
i'm not sure which space you are talking about

Halim said...

You see between long rectangular narrow line and my navigation bar in the middle of these two point there is a green space I am talking about that space. how to remove that space?

Here is my blog address
http://wirelessphonereviews.blogspot.com

Lawny said...

@Halim
the codes you are using are different from the one's described above so i don't have time right now to look through your code but you could try .descriptionwrapper{display:none;} since you are not using the blog description it will hide the div and p tag and close some of the space but it will still need tweaking more also some of your CSS code is invalid such as display:yes;