HTML Links
HTML Links
HTML links or hyperlinks are words, phrases, or images in online content that, on clicking,
take the site visitor to another web page with related content. Links are an integral part of the
world wide web.
Links connect pages both within a website and to other websites. They enable site visitors to
collect relevant information in less time by clicking their way from one page to another on
any server across the world.
There are two ends of a link: anchor and direction. The link will start at the ‘source’ anchor
and point to the ‘destination’ anchor. The destination anchor may be an HTML document,
image, video, or a section within an HTML document.
Syntax:
Explanation:
● <a></a>: This is the anchor tag that creates a hyperlink. Anything between this tag
becomes part of the link. The user can click that part to reach the linked document.
Example:
<html>
<head>
<title>Example of HTML Link</title>
</head>
<body>
<p>Click on the below link</p>
<a href = "-------">ABC</a>
</body>
</html>
Syntax:
Example:
<html>
<head>
<title> Internal link example </title>
</head>
<body>
<p> Cascading Style Sheet is used for styling the web pages</p><br><br>
Syntax:
<a href= “Pagename.html or URL”> text to be written on link </a>
Here, Pagename.html or URL is the name of the webpage or address where link will
navigate on click.
Example:
<html>
<html lang="en">
<head>
<title>External Link Example</title>
</head>
<body>
<h1>Welcome to My Website</h1>
<p>Click the link below to visit an external website:</p>
<a href="https://www.example.com">Visit Example Website</a>
</body>
</html>
Syntax:
<a href="">
<img src=""">
</a>
Example :
<html>
<head>
<title>Image as a Link</title>
</head>
<body>
<h1>Click on the image to visit Example Website</h1>
<a href="https://www.example.com">
<img src="https://via.placeholder.com/150">
</a>
</body>
</html>
Explanation:
<a href="https://www.example.com" target="_blank">: The anchor tag creates a link to the
specified URL.
Syntax:
<a href= “e-mail id”> Send email </a>
Example:
<! DOCTYPE html>
<html>
<head>
<title> Email link Example</title>
</head>
<body>
<h1> This page creates an emailing link in html webpage</h1>
<br>
<a href= "[email protected]"> Send an email </a>
</body>
</html>