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

Hash anchor tag

Hi all,

If you have a link with, for example:

<p><a href="#" class="btn"> Browse Our Cupcakes</a></p>

I see that for the purposes of this example, there was no hyperlink to another page, so it was substitued for '#'.

My question is, why does the # tag take you to the top of the page if you click the link? Is it something to do with an anchor?

Thanks!

2 Answers

(#) used for links within a web page with a defined ID attribute.

Check out: http://teamtreehouse.com/library/websites/html/links

All the best ! Moh

Great video. Gotta love Treehouse (and the forum)!

Thanks for the tip Moh.