Reputation: 19
I am creating a school project website and is organizing my files to different folders. From root folder to css, script, etc... This is the structure I made.
But I couldn't access my index page from subpages. If I am to go from index to about us for example:
<a href="pages/about-us.html">
It would take me to the about page. But going back to index, I tried:
<a href="root/index.html">
and
<a href ="index.html">
But no luck. Surely, it would work if I would copy paste the exact location in my PC. But I will upload this for my professor to see. Also, not to mention the images too that I need to link from a folder up from the subpages. If that make sense.
Bottomline: How do I link files from different folders whether one folder up or one folder down?
Thank you in advance. :)
Upvotes: 0
Views: 2290
Reputation: 4421
Using ../
allows you to jump back a directory (folder) and ../../
would jump back two directories. If your at the root directory you can access a file with /index.html
. Have a look at the Dealing with files - MDN documentation for more detailed information.
Upvotes: 2