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 Introduction to HTML and CSS (2016) HTML: The Structural Foundation of Web Pages and Applications Anchor Tags

Cate C
Cate C
4,734 Points

#top -- not a standard, is it?

The course states that #top in href will create a jump link to the top of the page. However, the code does not contain any id with the value "top". Searching online I can find nothing stating that using "top" in href without defining it is a new standard. Is this defined in HTML5 as a standard? or just commonly used?

4 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

I agree with Steven Parker. That being said, there is MDN documentation on just this subject! This behavior is specified in HTML5.,

Hope this helps! :sparkles:

Steven Parker
Steven Parker
231,268 Points

Excellent reference. I did not know where to find the documentation this time.
Usually it's the other way 'round: I don't remember the fact until I look it up again in the docs.

Steven Parker
Steven Parker
231,268 Points

I think most browsers treat the top of the page as if it had the ID of "top", but only if no actual "top" ID exists. If you give an element the ID of "top", then an href of "#top" will point to it instead of the top of the page.

A more universal standard (and reliable reference) for the top of the page is just "#" by itself.

Kieran Barker
Kieran Barker
15,028 Points

No, I don't think it's a standard. Using the # symbol on its own would do the same thing.

Cate C
Cate C
4,734 Points

Yes, Jennifer, that is very helpful and good to know that it is part of HTML5. Thanks all for your responses