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 trialLesenia Maldonado
155 PointsHow do I set an anchor?
How do I set an anchor tag to go back to the top of the page?
<!doctype>
<html>
<head>
<title>My trip to Spain</title>
</head>
<body>
<img src ="images/spain.jpg">
<p>Here is a picture of me in Spain last summer!</p>
<a>Go back to the top of the page.</a>
<a href = "#top">
</body>
</html>
5 Answers
Unsubscribed User
Front End Web Development Techdegree Student 33,900 PointsHi Lesenia,
as Rod Miky already pointed out - you create a link this:
<a href="url">Link Name</a>
If you want it to go to the top of the page, instead of an url you just write the hash tag symbol β#β or β#topβ. Both will lead to the top of the page.
So like this:
<a href="#">To the top</a>
Or like this:
<a href="#top">To the top</a>
Happy coding!
Unsubscribed User
Front End Web Development Techdegree Student 33,900 PointsHi again,
it sounds like it did not work out yet? ;-)
So I give you the complete solution code:
<!doctype html>
<html>
<head>
<title>My trip to Spain</title>
</head>
<body>
<img src ="images/spain.jpg" alt="A picture of me in Spain">
<p>Here is a picture of me in Spain last summer!</p>
<a href="#top">Go back to the top of the page.</a>
</body>
</html>
I just tried it out. It works and will be accepted as correct.
Lesenia Maldonado
155 Pointsyes the code provided above worked perfectly! thank you!
Lesenia Maldonado
155 PointsHello everyone! Thank you for your time for helping me figure out what I was missing. The code I used was <a href="#">To the top</a> now I'm working more into CSS!
Unsubscribed User
Front End Web Development Techdegree Student 33,900 PointsGreat, if you have any questions, always feel free to reach out. There are so many people here who are happy to help, it's awesome...
And if you continously keep going soon you can help others. Enjoy the journey!
Rod MIky
18,784 Points<a href="url">LInk Name</a>
Lesenia Maldonado
155 Pointsthank you guys so much! I tried every way possible! Thank you for your help!
Unsubscribed User
Front End Web Development Techdegree Student 33,900 PointsI posted the complete solution below.
Let me know if anything is unclear, I am happy to help. :)