Attributes of the <a> Tag

Converting to HTML 5

Attributes of the <a> tag

href attribute

If the value of the href attribute is a URL , it may contain any of the following components:

  1. protocol scheme, typically "http:" or "https:"
  2. host name or IP address
  3. port number, which defaults to 80 for the HTTP protocol
  4. absolute or relative path
  5. search query, indicated by "?"
  6. fragment identifier, indicated by "#"

If the protocol scheme, host name/IP address and port number are omitted the default is the current host - the same server handling the current document. If the path starts with a slash /..., it is an absolute path from the base of the current document, which defaults to the document root directory on the server. A URL with a "#" but no fragment identifier points to the top of the document.

<a href="#">back to top</a>
<a href="another-page.html">another page</a>
<a href="/another-section/">another section</a>
<a href="http://www.ExampleOnly.com/">Example Only</a>
id attribute
The id attribute
common attributes
In addition to the attributes above, which are specific to the <a> tag, any of the common HTML attributes can also be used.

Prev: Syntax Next: rel= 

Home > HTML Tags > HTML <a> Anchor Tag > Attributes

Viewing mobile website page. Switch to WML or Full HTML