The Complete WebDeveloper (47 Blogs) Become a Certified Professional

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

Last updated on Apr 14,2022 240 Views


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:

a tag in html

 

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:

google link

 

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.

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 NameDate
Web Developer Certification Training Course

Class Starts on 29th October,2022

29th October

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

Class Starts on 26th November,2022

26th November

SAT&SUN (Weekend Batch)
View Details
Comments
0 Comments

Join the discussion

Browse Categories

webinar REGISTER FOR FREE WEBINAR
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP

Subscribe to our Newsletter, and get personalized recommendations.

image not found!
image not found!

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

edureka.co