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.
  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="" target="_blank">Super Machines - Open in New TAB!</a>
		<a href="" target="_parent">Super Machines- Open in similar parent TAB!</a>
		<ahref="" download>Super Machines - Click me to Download</a>


anchor tag in HTML


Comments and Discussions



Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© some rights reserved.