Jump to content

Recommended Posts

Posted

hi all,

 

Here's a question to be sure: how do I modularize CSS menus? In other words, I want to define a menu (e.g., orange Tree Horizontal Menu) once, and then call/invoke it from any number of pages. Is this possible, or must I duplicate the HTML code in every page? Seems to me that last method would be inefficient, since a change to the menu would require a change to each and every page. Please help me.

 

Thanks

------------------------------

software development company

Posted

If you create the menu's css in an external file. You can call that css page from any page. You would have to create the divs, tables, hyperlinks etc for each page. However, just add the id of each 'object' for the css to style.

 

So you might have an external css page like:

(default.css)

div.menu {

background-color: #000;

color: #f00;

}

 

Then in a the html pages you can call the default.css page.

 

.

Page Using CSS

 

 

Hope this helps

Posted
You would have to create the divs, tables, hyperlinks etc for each page.

... unless you save your pages as .php instead of .html . If you do that then you can cut/paste your menu html into a separate file (say... 'menu.html') and include it on each page :

 


... stuff (including of course linking to style sheets) ... 



Header

Body of your page



 

This is assuming of course that your hosts provide php (most do these days). You have to save it as .php so that the server knows to look for <?php and ?> tags which signal the start and end of php code. "include" gets the server to replace that bit with the contents of menu.html . It's pretty straight-forward and will save you time when you go to add a new menu item or re-structure the site (as innevitably happens eventually).

 

Hello

:-Dave

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...