Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML HTML Basics Images, Text and Links Understanding File Paths

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.

  1. Why can't I just use the code <a href="index.html">Home</a> to do this?

  2. 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>

  3. How come it's different rule for when linking the Home link to index.html?

Thank you.

1 Answer

Steven Parker
Steven Parker
231,271 Points
  1. You need the "../" prefix because the file you are linking to is in the parent folder of the current one.
  2. You could also use a root-relative path name by starting with "/" and list all nested folders along the way.
  3. If you're already on the home page, you don't need to reload. The "#" reference just goes to the top of the page.

Thank you!