November 16, 2026
What is the Link <a> tag in HTML, and how is it used?
When you required to link one webpage to another webpage or want to move one block to another block of same webpage, so you can use hypertext links. Links are also called anchors. These hypertext link can consists of text and images, when users click on these links it result a other webpage or other block on same webpage. These links are also called hypertext, or hyperlink or hotspot. A browser represents hypertext in different color with design formats. We can make links with <a></a> tags. There are two type of hypertext link present which described below:
- Inter document link: when you make links to open other webpage, it's called inter - document link. If you want to make link in HTML then put content (text or images) between <a> and </a> tag it will automatically become a hyperlink. When you click this link it will open a new webpage or image. The path or URL of the webpage you have to specify in HREF which you want to open after clicking link.
Syntax
<a href="URL">Link Name</a>
Example
<html>
<head>
<title>A HTML Example</title>
</head>
<body>
<a href='http://www.evidenttutorials.com'>
Evident Tutorial's Home Page
</a>
</body>
</html>
In above mentioned example code will create a link with name "Google" as mentioned below. When you click this link, it will open google.com in your web browser.
Output
Evident Tutorial's Home Page
- Intra-document link: when you make links with in the same webpage, it's called intra - document link. Sometimes you required to move on same webpage's different part or block. First of all you will have to specify href attribute with # plus a name and then jump to that part using the name.
Example
<a href="#location_name">Link Name</a>
Above mentioned code will create a link with name "Link Name". When you click on this link it will search same name without # sign which you have mentioned in href attribute and move to that part of the document. Text block described below.
<html>
<head>
<title>A HTML Example</title>
</head>
<body>
<a name='location_name'>Text Block</a>
</body>
</html>
Email Links
An e-mail link uses mailto: protocol to forward mails on specified mail id in href attribute of <a> tag. You can create mail link such as described below:
<html>
<head>
<title>A HTML Example</title>
</head>
<body>
<a href='mailto://info@xyz.com'>Send Mail</a>
</body>
</html>
Attribute of <a></a> tag
| Attribute
| Description
|
| HREF |
Stands for hypertext reference. It is a path of the block within the same webpage or a path of other webpage which you want to link with it. If you do not provide HREF in tag the link will not work. Example of href attribute is:
<a href="URL">link name</a>
|
| Name |
Name attribute indicates the block on the same webpage where it will go after clicking link. Example of name attribute:
<a name="location_name">link name</a>
|
| Title |
Title attribute provides help description about link, just like tooltip. Example of title attribute:
<a name="location_name" title="link_title">link name</a>
|
| Target |
It decides where new webpage will be opened after clicking a link. Example of target attribute:
<a name="location_name" target="target_value">link name</a>
|
Values for target attributes of <a></a> tag.
| Values
| Description
|
| Blank |
It will show the linked page in new blank window. Example:
<a name="location_name" target="blank">link name</a>
|
| Parent |
It will show the linked page in the same window. Example:
<a name="location_name" target="parent">link name</a>
|
| Self |
It will show the linked page in the same window. Example:
<a name="location_name" target="self">link name</a>
|
| Top |
It will load the linked page in entire window. Example:
<a name="location_name" target="top">link name</a>
|
FAQ
1. What is the difference between an inter-document link and an intra-document link?
An inter-document link connects one webpage to another webpage, while an intra-document link navigates to a specific section within the same webpage using an element ID and the # symbol.
2. What is the target attribute in the HTML anchor tag?
The target attribute specifies where the linked document should open. Common values include _blank, _self, _parent, and _top.
3. What is the difference between the _blank and _self target values?
The _blank value opens the linked document in a new browsing context, usually a new tab, whereas _self opens the linked document in the same browsing context.