Log in

View Full Version : CSS and include files



slyredfox
05-16-2007, 02:08 PM
Hi All,

I'm trying to figure this out... Say I have 1 navigation include file with the following:

home / about / products / contact

And when someone is on the home page - the "home" style is set to "active" - might look like this:

home / about / products / contact

When on the products page the nav include file would be:

home / about / products / contact

Etc. etc.

My question is: How do I "tell" the include file to set one of the navigation links to active while keeping the other links inactive? If that makes sense.

Thanks.

boogyman
05-16-2007, 02:28 PM
are you talking about activating different style sheets?

http://alistapart.com/articles/phpswitch/

mwinter
05-16-2007, 05:25 PM
You might want to read the thread entitled dynamic CSS selectors or declarations (http://www.dynamicdrive.com/forums/showthread.php?p=32362#post32362). That seems to cover what you're attempting.

Veronica
05-16-2007, 05:26 PM
You could use Javascript and css to detect the page, and write an appropriate css depending on the URL. But a better way is to use just css.

You give each link a unique id, then the body section of each page gets an id. Your style for the navigation then changes depending on which page the user is on. There's a good explanation at http://www.hicksdesign.co.uk/journal/highlighting-current-page-with-css