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

Using the <a> element

Ok so here is my question. I am learning about the <a> element. In this video you can use a <a href="#top"> to move to the top off your page. I am also reading HTML&CSS by John Dockets. In the chapter about the <a> element he talks about using the code the same way but the reason why it moves to the top of the page is because he has <h1 id="top">. I understand why this works but in the code that the video is showing there is no id element in the top part of the code. Has this been phased out in HTML 5 where a id element is not needed. If anybody can shine some light on this it would help.

Thanks Andrew

3 Answers

the "#" symbol stands for an id as you said. Can you tell me what video you are referring to?

I think by default if the anchor link does not match an active ID on the page it will simply jump to the top of the page.

Thanks guys for all the help. The book I am reading jumps ahead, of the track I am on in Treehouse.