Creating simple a nav bar in HTML using Table

Introduction to Nav:

Img: Horizontal Nav bar
Img: Vertical Navbar

Nav is the menu or the list of webpage in a website. We can visit from one page to other easily using the nav of the webpage. The simple nav bar is shown below..



Home    Services    Contact     About

So above was a example to a simple horizontal navbar using CSS and HTML. As this is a tutorial for beginner, I am not gonna teach how to design a similar navbar, but if you want to add the similar nav to your page, here's the code..

<div style="background: green; color: white; height: auto; padding: 10px; width: 100%;">
<a href="" style="color: white;">Home</a>&nbsp; &nbsp;
<a href="" style="color: white;">Services</a>&nbsp; &nbsp;
<a href="" style="color: white;">Contact</a>&nbsp; &nbsp;
<a href="" style="color: white;">About</a>
</div>

Now let's create our own nav in table.. For that please read all tutorial carefully.
I have already explained about the table tag in my previous blogs and I have also taught you guys how to create a table along with it's attributes. So today we are gonna use the <Table> tag and <a> tag.
<table> tag is used to make a table whereas <a> tag is used to link the certain text to a certain page.
Let's start the tutorial now..
First of all we need a table without border.. In the same way you can even use cellspacing and cellpadding. Th and Tr tag are also used to add the list of menu in the horizontal row..
Here is the code for creating the nav in the table..

<table cellspacing="5" cellpadding="5">
<tr>
<th>Home</th>
<th>Services</th>
<th>contact</th>
</tr>
</table>

I hope you have no complications till now. If you can't get any thing please check my blog on table and it's attributes. It will create a list as below.


Home        Services         contact
Now let's add hyperlink in each of them.. For that please use the <a></a> tag.. Here's the code:

<table cellspacing="5" cellpadding="5">
<tr>
<th><a href="https://www.facebook.com">Facebook</a></th>
<th><a href="https://www.google.com">Google</th>
<th><a href="https://www.yahoo.com">Yahoo</th>
</tr>
</table>

It will create Nav as follow:

Facebook         Google         Yahoo

You can add the number of page by adding <th></th> tag inside table. Be sure that you link the pages correctly..
I hope this tutorial helped you in creating the nav. Nav is not responsive but for beginner, it's perfect.. 

Please smash the button below to keep updated with my newer blogs


Facebook Instagram Github Wordpress Twitter

Comments

Popular posts from this blog

Frameset In HTML explained

Inserting Image in HTML

HTML tutorial - I