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 HTML Basics Going Further with HTML Linking to Sections of a Web Page

why the # sign when linking

why do we make the # when we try to link to a page or a section or a article or anything.?

2 Answers

Ben Reynolds
Ben Reynolds
35,170 Points

You can combine them as well. If you want to link to another page and have them automatically land on a specific part of that page it would look like this:

<a href="/some-page.html#page-section">Link Text</a>
Ben Reynolds
Ben Reynolds
35,170 Points

You don't need it for a regular link that just navigates to another page. For that you just need the document path, or the full URL if you're linking to a page on another site.

The # symbol is used if you want the browser to jump to a specific part of the page. The id of the element you want to jump to goes right after the "#" just like you would write it in a css selector.