A link in HTML, created with the <a>
(anchor) element, allows users to navigate from one webpage to another or to a specific section within the same page. Links are essential for building connections between pages on the web, making it easier for users to explore information.
Links are used to connect different pages and resources, enabling smooth navigation and enhancing the user experience. They allow you to:
This example shows a link that navigates to an external website:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Welcome To My Links Page</title>
</head>
<body>
<a href="https://aitaurangabad.com/">Visit Aitaurangabad</a>
</body>
</html>
Visit Aitaurangabad
Internal links point to another page within the same website:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Welcome To My Links Page</title>
</head>
<body>
<a href="https://aitaurangabad.com/AboutUs.html">About Us</a>
</body>
</html>
About Us
Links can navigate to specific sections of the same page using an ID:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Welcome To My Links Page</title>
</head>
<body>
<a href="#https://aitaurangabad.com/ContactUS2.aspx">Go to Contact Section</a>
</body>
</html>
Go to Contact Section
To create a link that opens an email application, use mailto:
:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Welcome To My Color Page</title>
</head>
<body>
<a href="info@aitaurangabad.com">Email Us</a>
</body>
</html>
Email Us
Use the target="_blank"
attribute to open a link in a new tab:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Welcome To My Color Page</title>
</head>
<body>
<a href="https://aitaurangabad.com/" target="_blank">Open in New Tab</a>
</body>
</html>
Open in New Tab
Links are an integral part of web development, allowing users to navigate and interact with content easily. By understanding how to use different types of links, you can create a more navigable and user-friendly website.