+4 votes
72 views
in Tips & Tricks by (242k points)
reopened
reference to an anchor in HTML - here's how

1 Answer

+5 votes
by (1.6m points)
 
Best answer

Reference to anchors in HTML
Reference an anchor in the same HTML file
Reference an anchor in another HTML document

Would you like to insert direct references into your HTML document using an anchor? We'll show you how..

image image

It often makes sense to divide an HTML file into several sections. So that your user can directly access the individual sections, you have the option of setting a so-called anchor. With the help of the anchor, your reader can jump straight to the section without having to scroll unnecessarily. How to create an anchor can be found here.

Reference to anchors in HTML

Reference an anchor in the same HTML file

  1. If you want to reference your anchor in the same HTML document , create a reference by writing :

    <a href="#Ankername">Link</a>

  2. For #anchorname then give instead anchor the Name one that you have chosen for your anchor.
  3. Between <a href="#Anchorername"> and </a> enter the name with which you would like to refer to your anchor. In this example we have simply called this reference "Link".

Reference an anchor in another HTML document

  1. If you want to reference your anchor in another HTML document , create a reference by writing :

    <a href="dokument.html#Ankername">Link</a>

  2. Instead of document.html, enter the name of the HTML document to which you want to refer.
  3. For #anchorname then give instead anchor the Name one that you want to give your anchor.
  4. Now enter the name for the link between <a href="dokument.html#Ankername"> and </a> . In the example our reference is simply called "Link".

...