The Complete WebDeveloper (42 Blogs) Become a Certified Professional

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

Published on Aug 27,2019 16 Views

MI-new-launch

myMock Interview Service for Real Tech Jobs

myMock-mobile-banner-bg

myMock Interview Service for Real Tech Jobs

  • Mock interview in latest tech domains i.e JAVA, AI, DEVOPS,etc
  • Get interviewed by leading tech experts
  • Real time assessment report and video recording

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 Full Stack Web Developer Masters Program 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.

Comments
0 Comments

Browse Categories

webinar REGISTER FOR FREE WEBINAR
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.