View Full Version : Referencing a folder in a higher level

06-25-2010, 05:31 PM
Hey all,
I have a kind of stupid question, and once again it involves how I'm sorting my webpages inside a folder. So here's the deal. I have a main page index.html that is inside my main folder. I have a lot of sub pages inside a folder called 'sub'.

But my problem is, when my sub pages are inside 'sub, they can't 'see' the CSS files and the images that I have in my main directory or in other subfolders. So short of making duplicates of all of my css and images, I don't know how to get the subpages to see these files.

Is there a way to do a reverse of subfolder. i.e a subfolder would be "sub/page.html" but is there a way to reference the folder above it? Such as ".../styles.css", for example.


06-25-2010, 06:51 PM

If index.html and styles.css are in the root folder, and this also has a folder called sub, then html files in sub access css via "../styles.css".

Alternatively, you could use an absolute reference which always starts from the root - which would be "/styles.css". This can be useful if you have several levels of folder as it will always remain the same.