...

View Full Version : Subdirectory problem with css



luzhuangzhuang
08-09-2007, 04:16 PM
I'm sure this is very easy to solve for you guys, but for me I have no idea. Please help.

I have recently made the move to learning div and css, and I'm a little stuck with my stylesheet. I want to use it across my whole website, but I have many subdirectories each with their own index files (in php). When I try and include the stylesheet with one of these index files, it assumes it is in the subdirectory, which of course it isn't. I don't want to make a stylesheet for each directory, as it kinda defeats the purpose. So I want to know how to link to a directory outside and possibly above the subdirectory I am working on.

I have this problem twice because I am also trying to include a header and footer file, with the same problem. I already tried the full localhost address, but that didn't help.

Thanks for your help, anyone who can.

Arbitrator
08-09-2007, 04:27 PM
You can reference the root directly with / and the parent directory with ../. Below are examples.


@import "/root.css";
@import "../parent.css";
@import "../../grandparent.css";

luzhuangzhuang
08-09-2007, 04:32 PM
Great, I'll give it a try... thanks for the swift reply too, perfecto!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum