Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

HTML HTML Links Websites: Part 1

I need help connecting my two html docs (with textedit).

I am using textedit to create two html documents. I am trying to connect them with an anchor element and then href. Both documents are in the same folder, however when I go to click on the link in the browser, the browser says there is no page to be found.

<body> <p>Our First Page</p> <a href=“second.html”>My Link</a> </body>

My Link appears hyperlinked, however when I go to click on My Link, the page cannot be found. Both html docs are in the same folder on my desktop. What am I doing wrong?

3 Answers

Erik Krieg
Erik Krieg
43,038 Points

Sounds like you have written you href's value incorrectly. I will describe to you an example where I have an html file called index.html that I want to link to about.html. If the files are in the same location, the following html would link me from index.html to about.html:

<a href="about.html">About Me</a>

Be sure you spell the name of your file correctly and include the .html file extension.

Hope this helps!

Thanks. I rewrote my href values but it is still not working. I have also tried to add an id and instead of taking me to Anchor, it says the page cannot be found: <a href=“#some_text”>My Link</a>

<p id=“some_text”>Anchor</p>

Any suggestions? I have watched the videos again and I have redone everything step by step but it is not quite working.

idan ben yair
idan ben yair
10,288 Points

Hi try to put the whole path of the link in to the html doc:

<a href = "/desktop/folder/yourother.html">your link</a>

sometimes just putting in the name of the document or file doesnt work even if both files are in the same folder. Let me know if that worked for you.

Thanks. I put the whole path of the link but it is still not working. I have also tried to add an id and instead of taking me to Anchor, it says the page cannot be found: <a href=“#some_text”>My Link</a>

<p id=“some_text”>Anchor</p>

Any suggestions? I have watched the videos again and I have redone everything step by step but it is not quite working.

idan ben yair
idan ben yair
10,288 Points

can you tell me which assignment was that? copy the code here and I'll be able to assist.

Thank you so much. Track: Web Design-HTML-Links-Websites: Part 1 This is what I have:

<!doctype html> <html lang=“en”> <head> <meta charset=“utf-8”> <title>My Page</title> </head>

<body>

<a href=“about.html">My Link</a>

</body> </html>

I have an about.html document created in the same folder as this index.html. The folder is on the desktop and I am using textedit on Mac. I saved both docs in this folder I created.

After I post the comment the code shortens, are you able to see it?