How to Add Internal HTML Links

Using the ID attribute tag to create page bookmarks

What to Know

  • Name section by adding an ID attribute to the tag. Create the internal link as you would for an external link, but replace the URL with the ID.
  • HTML 4 and earlier versions used the name attribute to form internal links. HTML 5 uses the ID attribute instead.

ID attribute tags allow site visitors to click a link and be transported to a bookmarked location within the same document. A typical application is a list of included topics at the top of an article, similar to a table of contents.  Here's how to add internal links in HTML.

How to Add Internal HTML Links

This approach entails naming the area to which you'd like to link and then creating a link to it using an ID attribute. Here's how:

  1. Decide which section of the page you'd like to link to. As an example, let's say you want to link to the last paragraph at the bottom of a page.

  2. Name the appropriate section by adding an ID attribute to the tag. In this example, it's named lastparagraph, like so:

    The last paragraph
  3. Create the internal link just as you would for the more common external link, but replace the URL with the ID of the last paragraph:

    The link
  4. Test your link.

    W3Schools offers a free online code "sandbox" where you can test your HTML.

Format
mla apa chicago
Your Citation
Kyrnin, Jennifer. "How to Add Internal HTML Links." ThoughtCo, May. 14, 2021, thoughtco.com/adding-internal-links-3466484. Kyrnin, Jennifer. (2021, May 14). How to Add Internal HTML Links. Retrieved from https://www.thoughtco.com/adding-internal-links-3466484 Kyrnin, Jennifer. "How to Add Internal HTML Links." ThoughtCo. https://www.thoughtco.com/adding-internal-links-3466484 (accessed September 29, 2021).