Home » HTML

Anchor Tag in HTML with Example

Learn: In this article we will learn about Anchor Tag and some of its attributes with Example in HTML.
Submitted by Mayank Singh, on August 08, 2017

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:

  1. 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
  2. Relative Link:
    These are the links which are related to our own document and these types of links are the part of our website.
  3. Internal Link:
    It is used to navigate from one portion of our webpage to other portion of our webpage.

Attributes for the Anchor Tag:

  1. href:
    It stands for hyperlink reference, it is used to add link to our Webpage.
  2. 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.
  3. 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>
	<meta charset="UTF-8">
		<title>Using Anchor Tag in HTML5</title>
		<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>
		<a href="https://www.facebook.com/groups/super.machines.experts/" target="_parent">Super Machines- Open in similar parent TAB!</a>
		<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>


anchor tag in HTML

Comments and Discussions!

Copyright © 2023 www.includehelp.com. All rights reserved.