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

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?