Q. Define about Anchor Tag?
Anchor tag is used to create links between various objects such as HTML pages, web sites, files etc. It is introduced by characters <A> and terminated by </A>. HREF is the most common attribute of ANCHOR tag. It defines destination of the link.
<HTML>
<HEAD>
<TITLE>Expertsmind</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
Go to <A HREF="https://www.expertsmind.com/">Expertsmind!</A>
</BODY>
</HTML>
As demonstrated in Figure below, text "EXPERTSMIND.COM" present between <A> and </A> tags becomes the hyperlink. On clicking anywhere on this hyperlink, browser would attempt to connect to given URL and website https://www.expertsmind.us would open, if possible. An email link could be specified in the same way. We just have to specify email address rather than a page address as the value of HREF as demonstrated in following code. On clicking on the link, default mail program on the user's computer opens up with a "To:" address as specified in the hyperlink. You can then type your message and send e-mail to that particular address.
<BODY BGCOLOR="#FFFFFF">
Send me <A HREF="mailto:[email protected]">mail</A>
</BODY>
It's also possible to make an image a link if desired. This is achieved using <IMG> tag. Consider the below illustration.
<HTML>
<HEAD>
<TITLE>EXPERTSMIND.COM</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
Go to <A HREF="https://expertsmind.com.com/"><IMG SRC="image.gif" WIDTH=130
HEIGHT=101></A>
</BODY>
</HTML>
So in the illustration demonstrated in Figure, image becomes the link. When user clicks on image, web site https://www.expertsmind.us opens up, if possible.