Setting the Home Link in the nav to go to index.html from inside subfolder
Hi, can someone help me understand the part of the video from 3:23 to 4:21. Basically it wants us to set the Home link in the nav to navigate to index.html.
Why can't I just use the code <a href="index.html">Home</a> to do this?
Why do I need to go up one level, out of the current folder, and up to its parent folders. What is the reasoning behind that?I thought that to link to a file, you start from the root folder then go down, just like the code we used when we wanted the Read More link to take us to the articles page for example <a href="article/article.html>Read More</a>
How come it's different rule for when linking the Home link to index.html?
Steven Parker200,778 Points
- You need the "../" prefix because the file you are linking to is in the parent folder of the current one.
- You could also use a root-relative path name by starting with "/" and list all nested folders along the way.
- If you're already on the home page, you don't need to reload. The "#" reference just goes to the top of the page.