Javatpoint Logo
Javatpoint Logo

HTML Anchor

The HTML anchor tag defines a hyperlink that links one page to another page. It can create hyperlink to other web page as well as files, location, or any URL. The "href" attribute is the most important attribute of the HTML a tag, and which links to destination page or URL.

href attribute of HTML anchor tag

The href attribute is used to define the address of the file to be linked. In other words, it points out the destination page.

The syntax of HTML anchor tag is given below.

<a href="">Click here</a>

Following are some specifications about the HTML <a> tag

Display Inline
Start tag/End tag Both Start tag and End tag
Usage Textual

Let's see an example of HTML anchor tag.

Test it Now

Note: By default anchor tag link opens in same window/tab.

Specify a location for Link using target attribute

If we want to open that link to another page then we can use target attribute of tag. With the help of this link will be open in next page.


Test it Now


HTML Anchor


  • The target attribute can only use with href attribute in anchor tag.
  • If we will not use target attribute then link will open in same page.

Create a hyperlink Without Underline.

Test it Now

Note: We have used text-decoration: none; to remove underline from the hyperlink.

Create multiple links and open link in one window only:

We can add multiple links in one webpage

Test it Now

Create an image link:

Test it Now

Create email and phone link:

Test it Now

Appearance of HTML anchor tag

An unvisited link is displayed underlined and blue.

A visited link displayed underlined and purple.

An active link is underlined and red.

However, we can change the color of the link and remove underline using CSS properties.


Following is the list of the commonly used attributes of <a> tag:

Attribute Value Description
href It gives the URL of the page where the link opens.
target _self _blank _parent _top It defines where to display the linked URL.
hreflang This defines the language of the linked resource.
  • Alternate
  • Author
  • Bookmark
  • External
  • Help
  • License
  • Next
  • Nofollow
  • Noreferrer
  • Noopener
  • Prev
  • Search
  • tag
It defines the relationship between the linked object and the target object.
type It specifies the media type of linked resource.
DownloadHTML Anchor File_name It instructs the browser to download a URL instead of loading.
charset Char_encoding It specifies the character set of the linked document. (Not supported in HTML5)
coords coordinates It specifies the coordinates of the linked document. (Not supported in HTML5)

Global Attribute:

<a> tag supports the Event Attributes in HTML

Event Attributes:

<a> tag supports the Event Attributes in HTML

Supporting Browsers

Elementchrome browser Chromeie browser IEfirefox browser Firefoxopera browser Operasafari browser Safari
Next TopicHTML Image

Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials

B.Tech / MCA