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 Links Websites: Part 2

João Ignácio Brito
João Ignácio Brito
1,201 Points

Can't use ../ properly

Playing around with what I just learned and can't use ../ properly, My file is saved on the desktop and the other pages in a folder on the desktop but when i do the href="../file name in the desktop" it can't reach it....

2 Answers

Chris Davis
Chris Davis
16,280 Points

If you were linking to a file up the file tree as your example explains, your link would look like this...

<a href="myFolder/myFile.html">Click Me</a>

However, if you were linking to a file back in the parent folder, then your link would look like this...

<a href="../myFile.html">Click Me</a>

Hope that help :thumbsup:

Something that happened to me was that I was saving the files to a different location than the file path I was providing (and expecting) within the anchor tags. I finally figured this out because new index.html and another_page.html files started appearing in my Documents and I noticed the file path when I would Cmd+S in my text editor. I resolved this by using Save As once I updated by anchor tags in each file.

I'm not too sure why my files started saving in a new location but I did change my folder structure at one point.