Add Site or Add Page to Favorites
> 

 HTML <a> Anchor Tag 

Clarify the meaning of the acronyms on your web site.

Acronym Dictionary

Acronym Finder

Get information on your favorite TV Shows at TV Series .com

Social Networking Web Sites


Printer-friendly PDF* format:

HTML <a> Anchor Tag

The <a> Anchor Tag

The <a> placeholder link (anchor tag) in HTML 5

The <a> tag is used to define a hypertext link.

Converting to HTML 5

We are working on converting to HTML 5. Please visit HTML <a> Tag on the HTML 5 standard version of this site.

<a> Tag Syntax

Syntax of the <a> tag

Attributes of the <a> Tag

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.
Relationships for the HTML 5 <a> Tag

<a> tag relationships

The rel values for the <a> tag are:

alternate
Links to an alternate representation of the document. For example:
archives
Links to previously created versions of related documents, such as the archives of a blog.
author
Links to a document about the author of the document in which the link tag appears.
bookmark
Provides a permanent link to the document or a section within the document.
contact
Links to a document with contact information.
external
Indicates that the link is to a resource on a different web site.
feed
Links to a syndicated feed channel for the document or the web site.
first
Links to the first document in a series of articles.
help
index
Links to an index document or a table of contents for the collection of documents that includes the document in which the link tag appears.
last
Links to the last document in a series of articles.
license
Links to a document that describes the copyright license that applies to the document(s) in which the link to the license page appears.
next
Links to the next document in sequence.
nofollow
Indicates to search engine crawlers and other robots that they should not follow the link to the referenced resource and process the document there. This can be used to indicate that the linked document should not be considered to be a recommended resource when determining the search engine rank for the linked page. This may help the page where the link appears from being penalized for "recommending" less desirable pages, such as for links to an affiliate site.
noreferrer
Indicates that the user agent should not identify the referring page to the server handling the request for the target page. If this value is omitted or ignored, the URL of the page containing the link will most likely be included in the Referer[sic] header of the HTTP request for the referenced page.
prev
Links to the previous document in the series.
search
Links to a search page for the web site or a subset of documents that includes the document in which the search link appears.
sidebar
Indicates that the referenced document should be loaded into the web browser's sidebar if the link is activated by the user.
tag
Specifies a URI that is a "tag", which describes the subject of a page. The tag may be a URL, which leads to a web-accessible page, or just a standalone identifier.
up
Links to the document at the next higher level in a tree hierarchy.
HTML 5 Examples

Examples of the a tag in HTML 5

The <a> tag for HTTP hypertext links

                                 <a href=""></a>
                                 

The <a> tag for other URI protocols

                                 <a href="tel:+17775551234">Call Me at +1-777-555-1234</a>
                                 
Changes in HTML 5

What's new in HTML 5

Differences between HTML 5 and earlier versions

The media attribute has been added for consitency with the <link> tag

The following attributes should not be coded on the <script> tag because they either have been deprecated or were never officially supported:

In HTML 5, you can put the <a> tag around block elements in addition to inline elements. This means that links can appear where they couldn't before. For example, you can turn a whole HTML table row into a link:

                                 <table>
                                 
<tr><td>Label:</td><td>Data...</td></tr>
...
<tr onclick="location=this.getElementsByTagName('a')[0]">
<a href="new-row.html"/>
<td colspan="2">Add a Row</td>
</tr>
</table>

Last updated Sunday September 19, 2010

You are currently viewing this page in HTML 4* format (* see Clicklets for more infomation). This document is also available in XHTML 1 Style Sheet*XHTML 1* XML*HTML 5 Style Sheet*HTML 5 XML*HTML 5 non-XML* XHTML Mobile* WML Mobile* and printer-friendly PDF* formats. This is accomplished with Single Source Publishing, a content management system that uses templates in XSLT style sheets provided by XML Styles .com to transform the source content for various content delivery channels. There is also RDF* metadata that describes the content of this document.


Copyright © 2010 Accilent® Corp. Alteration of content, including addition of any function such as hypertext links or pop-up advertising, or interference with the hypertext links or other functions of this site is expressly prohibited.

DISCLAIMER: All information, links, forms, applications and other items on this site or obtained from it are provided AS IS, WITHOUT WARRANTY OF ANY KIND EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.