Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
06-25-2010, 04:31 PM #1
- Join Date
- May 2010
- Thanked 0 Times in 0 Posts
Referencing a folder in a higher level
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, 05:51 PM #2
- Join Date
- Feb 2009
- Ilkley, West Yorkshire, UK
- Thanked 727 Times in 721 Posts
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.