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 trialKarem Ortiz
1,203 PointsThere is an error in the anchor tag section when I apply the a href tag with #top and refresh the page it do
Hello everyone,
I think there is an error in the anchor tag lesson 10:20 am So when I apply the a href tag with #top and refresh the page it does not work probably because is needed a class placed at the top in the head section?
Please let me know
7 Answers
Tom Achki
3,680 PointsYou're welcome. Happy to help! Make sure to ask again if something does not work :)
Tom Achki
3,680 PointsShe 100% does that. Maybe they forgot to show where she writes that in the video. Now your a tag is looking for an element that has an id "top". You want it to go back to the top of the page, so place the id "top" on the element that is on top of the page. For example header.
<header id="top">This is a header</header>
This way, whenever you click that link (a href tag) it will scroll up to the header. Let me know if you got it
Amy Chatas
Front End Web Development Techdegree Student 158 PointsTom Achki I did as you recommended but changed it to:
<header id="top"></header>
When I included the words: This is a header as you indicated...it adds those words at the top of the page. I didn't want to see that so removed the words and still make it to the top of the page.
Karem Ortiz
1,203 PointsThis is how my code looks like with the a href tag:
<p><a href="#top"><img src="http://placeimg.com/400/480/people" alt="Drawing of Jane Smith" class="profile-image">This is a third paragraph</a></p>
I haven't placed an ID yet, where shall I place it? She does not do that in the video?
Karem Ortiz
1,203 PointsI have placed the id inside the header tag as follows: id="top" and now it is working!
Thanks a bunch Tom!
Tom Achki
3,680 PointsWhen you type <a href="#top"></a>, the website looks for an element that has an id "top". Make sure to give the id "top" to the element that is on top of the page such as header or navigation bar.
Karem Ortiz
1,203 PointsI understand, but in the video she does not do that. Why? thanks!
Andrew Uzoka
1,949 Pointsthat is a good solution. you can also write like this, <p><a href="#"><img src="http://placeimg.com/400/480/people" alt="Drawing of Jane Smith" class="profile-image">This is a third paragraph</a></p> - which is a built in command navigating you to the top of the page
Victor A Hernandez
1,957 PointsAt this time this is to advanced for me!!!