Link in HTML


HTML5 / Sunday, August 12th, 2018

Table of Contents

Link in HTML

Hyperlink or link in HTML are one of the most important characteristics of web pages. A link moves us from the current page to a destination that is specified in the HTML page.

URL Stands for Universal Resource Locator. A URL is just an address that tells the browser precisely where on the Internet the resource is to be found. The process of parsing the URL and actually connecting to the resource can be somewhat complex and does not concern us here.

Anchor Tag

The Anchor tag is used to creating links between different objects like HTML pages, files, websites etc.  It is introduced by the characters <A> and terminated by </A>. HREF is the attribute of the ANCHOR tag that defines the destination of the link.

<!DOCTYPE html>
<html>
<head>
	<title>Links in HTML</title>
</head>
<body>
	Go to <A HREF="https://livedu.in/">LIVEDU!</A>
</body>
</html>

As shown in example, the text “LIVEDU” present between the <a> and </a> tags becomes the hyperlink. On clicking anywhere on this hyperlink, the browser would attempt to connect to the given URL and the website https://livedu.in would open, if possible.

An email link can be specified in the same way. We just have to specify the email address instead of a page address as the value of href as shown in the following code.  On clicking on the link, the 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 an e-mail to that address.

<BODY BGCOLOR=”#FFFFFF”>

Send me <A HREF=”mailto:[email protected]”>mail</A>

</BODY>

It is also possible to make an image a link if desired. This is done using the <IMG> tag. Consider the following example.

<!DOCTYPE html>
<html>
<head>
	<title>Image Linking</title>
</head>
<body>
	<A HREF="https://livedu.in/"><img src="Mylogo.png"></A>
</body>
</html>

So in the example shown, the image becomes the link. When the user clicks on the image, the website https://livedu.in opens up, if possible.;

Leave a Reply

Your email address will not be published. Required fields are marked *