<a href="#"><a name="">

Browser
  • IE
  • Cr
  • Sf
  • Fx
  • O
Type

The A element defines an anchor.

You can create a link to a named anchor by using the name attribute (or the id attribute).

When linking within the same document, the A element is set as follows.


<a href="#Anchorname">linked text</a>

(Target point)
<a name="Anchorname">a named anchor</a>

Attribute Value Explanation
href=" " #anchor name a number sign (#) and the anchor name
name=" " anchor name arbitrary name
Create a named anchor
  • Anchor names must be unique within a document.
  • Anchor names are case-sensitive.
  • The following symbols can be included in an anchor name.
    hyphen(-), underscore(_), colon(:), period(.)
    name="anchor_name"
  • Anchor names must start in the alphabet.
    name="a001"
Link to a named anchor
  • Type a number sign (#) and the name of the anchor.
    href="#a001"

Example

Example of using the name attribute

<h1>TAG index</h1>

<h2>Anchor example</h2>

<h3><a name="menu">Menu</a></h3>
<ul>
<li><a href="#a001">Jump to a001</a></li>
<li><a href="#a002">Jump to a002</a></li>
<li><a href="#a003">Jump to a003</a></li>
</ul>

<h3><a name="a001">a001</a></h3>
<p>paragraph text ...</p>

<h3><a name="a002">a002</a></h3>
<p>paragraph text ...</p>

<h3><a name="a003">a003</a></h3>
<p>paragraph text ...</p>

<hr>

<p><a href="#menu">Jump to Menu</a></p>

Output
Example pagenew window
Example of using the id attribute

<h1>TAG index</h1>

<h2>Anchor example</h2>

<h3 id="menu">Menu</h3>
<ul>
<li><a href="#a001">Jump to a001</a></li>
<li><a href="#a002">Jump to a002</a></li>
<li><a href="#a003">Jump to a003</a></li>
</ul>

<h3 id="a001">a001</h3>
<p>paragraph text ...</p>

<h3 id="a002">a002</h3>
<p>paragraph text ...</p>

<h3 id="a003">a003</h3>
<p>paragraph text ...</p>

<hr>

<p><a href="#menu">Jump to Menu</a></p>

Output
Example pagenew window