a tag

<a> (Anchor Tag)


a tag mentions a hyperlink, which a user can use to move from one page to another.
<a href="Link">Text</a>
Links by default will appear as follows:
1] Active link - Underlined and appears in red color.
2] Visited link - Underlined and displayed in purple color.
3] Unvisited link - Underlined and shown in blue color.
Element Specific attributes supported by this tag are:
hrefurlIndicates the URL of the link page.
hreflanglanguage_codeMentions about lang of document available in the link page.
mediamedia_queryDefines the media/device, for which the link is optimized.
relbookmark, license, alternate, help, next, nofollow, prefetch, noreferrer, tag, prev, search, authorReveals the connection between current page and link.
target_top,_blank,_parent,_self, framenameIndicates where to open the link.
typemime_typeMentions MIME type of the linked document.

The above mentioned "Element Specific" attributes will function only when the "href" attribute is inserted in <a>.

Example Code 1:

Result 1:

Example Code 2:

Result 2:

Example Code 3:

Result 3:
  • In HTML 4.01, <a> was used as both hyperlink & anchor.
  • "_blank" value of target attribute helps to open a link in new window of a browser.
  • "self" value of target attribute is used to open a link in same page.
It is available in previous versions of HTML.
It supports both Global Attributes and Event Attributes in HTML5.


It is applicable to all the browsers.

Ask Questions

Ask Question