Home »
HTML
Anchor Tag in HTML with Example
By IncludeHelp Last updated : October 13, 2024
Anchor Tag : <a>...</a>
This tag is used to link our webpage to other webpages mainly with the help of "href" attribute.
There are different types of links:
- Absolute Link:
These are the links which are fully qualified as a URL (Uniform Resource Locator), they are present on the Web already. Ex. https://www.google.co.in
- Relative Link:
These are the links which are related to our own document and these types of links are the part of our website.
- Internal Link:
It is used to navigate from one portion of our webpage to other portion of our webpage.
Attributes for the Anchor Tag
- href:
It stands for hyperlink reference, it is used to add link to our Webpage.
- target:
It is used in case of links, it helps if we want to open our link in a new tab orInthe same tab in which we are working.
- download:
It is a attribute which is used to download a file which is attached in our webpage just by clicking on it.It works only when href attribute is also used.
Example of Anchor Tag in a HTML Page
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Using Anchor Tag in HTML5</title>
</head>
<body>
<h1>Super Machines - Mayank's Technical Group</h1>
<a href="https://www.facebook.com/groups/super.machines.experts/" target="_blank">Super Machines - Open in New TAB!</a>
<hr>
<a href="https://www.facebook.com/groups/super.machines.experts/" target="_parent">Super Machines- Open in similar parent TAB!</a>
<hr>
<ahref="https://scontent.fbho1-1.fna.fbcdn.net/v/t1.0-9/20374424_1646326048735395_3349144471316475022_n.jpg?Oh=b543f2f377220ee652d3258a168e6565&oe=5A2B0074" download>Super Machines - Click me to Download</a>
</body>
</html>
Output