Web Development Thread, How to modularize CSS menus in Coding and Web Development; hi all,
Here's a question to be sure: how do I modularize CSS menus? In other words, I want to ...
29th January 2009, 11:02 AM #1
- Rep Power
How to modularize CSS menus
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.
software development company
29th January 2009, 04:20 PM #2
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:
Then in a the html pages you can call the default.css page.
<link rel="stylesheet" type="text/css" href="default.css" />.
<title>Page Using CSS</title>
<div id="menu">My Menu</div>
Hope this helps
29th January 2009, 07:35 PM #3
- Rep Power
... 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 :
You would have to create the divs, tables, hyperlinks etc for each 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).
<head> ... stuff (including of course linking to style sheets) ... </head>
<?php include 'menu.html'; ?>
<p>Body of your page</p>
By wesleyw in forum EduGeek Joomla 1.5 Package
Last Post: 22nd October 2008, 09:17 AM
By HodgeHi in forum EduGeek Joomla 1.5 Package
Last Post: 2nd June 2008, 11:38 AM
By jkmoch in forum EduGeek Joomla 1.0 Package
Last Post: 5th May 2008, 03:28 AM
By kerlj001 in forum EduGeek Joomla 1.0 Package
Last Post: 27th February 2008, 10:51 AM
By ianaddisonuk in forum Web Development
Last Post: 12th August 2007, 02:01 PM
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)