All you Need to Know About “a” tag in HTML

Last updated on Jun 14,2023 978 Views

All you Need to Know About “a” tag in HTML

edureka.co

Redirecting someone to another page or redirecting content to your webpage is a very good way to keep things interactive. This can be made possible by the “a tag in HTML”. Let’s understand this in the following manner:

 

What is a tag in HTML?

A link is specified using HTML <a> tag. This tag is also known as anchor tag and anything inside this opening <a> tag and closing </a> tag becomes the part of the link and the user can just click that part and can reach to that linked content or document. This <a> is the simple tag to use and is as follows:


<!DOCTYPE html>
<html>
		<head>
			<title> Link HTML</title
			<base href="http://www.edureka.com/">
		</head>
		<body>
		<p> Click any of the following links.</p>
		<a href="/html/index.htm" target="_blank"> Opens in new </a> |
		<a href="/html/index.htm" target="_self"> Opens in self </a> |
		<a href="/html/index.htm" target="_parent"> Opens in parent </a> |
		<a href="/html/index.htm" target="_top"> Opens in body </a>
		</body>
</html>

 

 

Options in a Tag

You can provide a lot of options in this a tag in HTML. Below are some of them

OptionDescription
_blankA linked document is opened in a new tab or new window.
_selfA linked document is opened in the same frame.
_parentA linked document is opened in the parent frame.
_topA linked document is opened in the full body of the window.
targetframeA linked document is opened in a named targetframe.

Example for the basic understanding the difference in few options given for target attribute of a tag.

 

Example


<!DOCTYPE html>
<html>
		<head>
			<title> Link HTML</title
		</head>
		<body>
		<h2> HTML Links</h2>
		<a href="https://www.google.co.in/" target="_blank"> Google </a>
		</body>
</html>

Output:

 

Example 2:


<!DOCTYPE html>
<html>
		<head>
			<title> Link HTML</title
		</head>
		<body>
		<h2> HTML Links</h2>
		<a href="https://www.youtube.com/" target="_blank"> Youtube </a>
		</body>
</html>

Output:

 

With this, we come to an end of this a tag in HTML article. I hope you understood what an anchor tag is. There are 3 of them at the beginning of this article as well.

Check out our web developer course online which comes with instructor-led live training and real-life project experience. This training makes you proficient in skills to work with back-end and front-end web technologies. It includes training on Web Development, jQuery, Angular, NodeJS, ExpressJS, and MongoDB.

Check out the Angular Certification program by Edureka, a trusted online learning company with a network of more than 250,000 satisfied learners spread across the globe. Angular is a JavaScript framework that is used to create scalable, enterprise, and performance client-side web applications. With Angular framework adoption being high, performance management of the application is community-driven indirectly driving better job opportunities.

If you want to get trained in React and wish to develop interesting UI’s on your own, then check out the React Certification Course by Edureka, a trusted online learning company with a network of more than 250,000 satisfied learners spread across the globe.

Got a question for us? Please mention it in the comments section of “a Tag in HTML” blog and we will get back to you.

Upcoming Batches For Web Developer Certification Training Course
Course NameDateDetails
Web Developer Certification Training Course

Class Starts on 28th December,2024

28th December

SAT&SUN (Weekend Batch)
View Details
Web Developer Certification Training Course

Class Starts on 4th January,2025

4th January

SAT&SUN (Weekend Batch)
View Details
BROWSE COURSES
REGISTER FOR FREE WEBINAR The Full Stack Web Developer Formula