Jump to content

How to use CSS to build Navigation menu & insert on all Web Pages


Recommended Posts

I am partially new to Web Site but have got as far as using CSS to lay out a page.


Here is my site: ***


My immediate problem is:


1. That Navigation bar on the left has several menu items in it. I am at a stage now where I need to change it, and that change I would like to appear on all the pages - automatically. However, I do not want to have to go to each of the 30 pages, edit them, to include the NEW menu item.


QUESTION. How do I use CSS or Javascript to build ONE Navigation menu file, place that file in my central folder, then put a link on all my Web pages to call that Navigation Menu bar?


Thank you.

Link to comment
Share on other sites



Welcome to the forum.


You have two options:


1. Change your pages to PHP pages and use PHP includes. Check out my video on PHP includes. The problem with this approach, that you will need to change the pages from being .html pages to .php pages.


2. You can use perhaps something based on Ajax or even more simply, use an iframe to contain your menu.


Which solution to choose?


If I didn't have much direct traffic coming to the sub-pages of the site, I would just go ahead with PHP includes - they are overall the best option. Otherwise, I would look to using an iframe.



Link to comment
Share on other sites

This might help you out...




Basically, you are looking at building one menu file, and including it in all of your pages. At the moment, that will mean editing 30 pages to add the include code in, but in the future, you would only have to edit one file, rather than 30.

Link to comment
Share on other sites

Thank you for the quick answer. I was hoping that it would not be necessary to learn a new method at this time. However, recently, I started trying to use .php to build a web site using osCommerce, so I may continue along this path.


I will take a look at those sites referred to, try them and get back to the forum.



Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...