Checkmark

Thank you for your feedback

How do I create anchor links?

Learn how to create HTML anchor links.

Article ID: SLN20471

Anchor links can help your visitors navigate sections of a long page by taking them directly to a particular area of the page. An anchor link consists of two parts:

  1. The link code:
    <a href="#myLink">Link</a>
  2. The anchor code:
    <a name="myLink">Anchor</a>

Note that the difference between the two links is the # symbol within the tag, as well as the <a name> tag. To create your anchor links:

  1. First build your link code:
    <a href="#myLink">Link</a>

    (Note that this link features a # symbol within the tag, which tells the browser to link to a corresponding anchor tag named myLink.)

  2. Now create your anchor link. Use the exact same name as in your link code:
    <a name="myLink">Anchor</a>

    Once again, this is not a normal link, because the link uses the word name instead of href. Which is important, because it tells the browser where to go when your first link is clicked.

To make your anchor tags work correctly, the word that appears in the quotes in the anchor and link tags must match. For example:

<a name="news">The Latest News</a>

<a href="#news">News</a>

Or:

<a name="style">Styles</a>

<a href="#style">Cardigan Sweaters</a>

To see an example of a working anchor link, click the word link below:

link

space
space
space
space
space
space
space
space
space
space
space
space
space
space
space
space
space
space
space
space
space
space
space
space
space

 

 Here is an anchor link.