The anchor element <a>, often called anchor tag, creates a hyperlink in HTML. The destination goes in the href attribute (short for hypertext reference), and the visible text between the opening and closing tag is the anchor text. In some contexts “anchor” also means a jump target inside a page.
How does the element work?
A basic link:
<a href="/guides/canonical/">Canonical tags explained</a>
According to MDN, href accepts absolute and relative URLs, fragments such as #section, and schemes such as mailto: and tel:. Other attributes include target, rel, download and hreflang. Google lists nofollow, sponsored and ugc as rel values for links it should treat differently.
Why does it matter for SEO?
Google states that it can discover links only if they are <a> elements with an href attribute. Google lists <span href>, onclick handlers without href, javascript: URLs and framework attributes like routerLink as not recommended. It may still try to parse them, but this is not reliable. Relative URLs work.
Anchor text should be descriptive, reasonably concise and relevant to the target page. Generic text such as “click here” is discouraged. For a linked image, Google uses the alt text of the image as anchor text. Every important page should be linked from at least one other page.
Example
<!-- crawlable -->
<a href="/shoes/">All shoes</a>
<!-- not reliably crawlable -->
<span onclick="goTo('/shoes/')">All shoes</span>
<a onclick="goTo('/shoes/')">All shoes</a>
Common mistakes
- Click handlers instead of links. The target is not in an
href, so Google cannot reliably extract it. - Empty targets such as
href="#". MDN advises a<button>for actions. - Vague link text. “Here” tells neither users nor crawlers where the link leads.
FAQ
What does href stand for? Hypertext reference. The attribute points to the link’s destination URL.
Sources
- <a>: The Anchor element – MDN Web Docsdeveloper.mozilla.org
- Make your links crawlable – Google Search Centraldevelopers.google.com
- Qualify your outbound links to Google – Google Search Centraldevelopers.google.com
Last updated: