Search code examples
htmlinternal-link

HTML: How to use internal links to text in a page?


Putting a link to text is really straightforward: <a href=www.link.com> Text </a>, and so is making that link a picture, but what I want to know how to do, and i have not yet found the answer through numerous google searches, is how i would have a table of contents at the top where each item is a clickable link that brings you down further in the page. How does one use internal links for text on the same page?


Solution

  • It is very simple. You just have to add an id to whatever element you want to link to. For example, <h1 id="Hello"></h1>. Then set your href to a # and then the id, <a href="#Hello">Go to Hello</a>.