HTML Links, also known as Hyperlinks, are used to connect one web page to another, allowing users to navigate easily between different pages, websites, or sections within the same page.
- The <a> (anchor) tag creates hyperlinks, using the href attribute to specify the destination URL.
- It can link text, images, or buttons for navigation.
- Links can open in the same tab or a new tab using the target attribute, and other common attributes include title for additional information.
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<p>Click on the following link</p>
<a href="https://www.geeksforgeeks.org/">GeeksforGeeks</a>
</body>
</html>
Output:
By default, links will appear as follows in all browsers:
- An unvisited link is underlined and blue.
- A visited link is underlined and purple.
- An active link is underlined and red.
HTML Links - Target Attribute
The target attribute in the <a> tag specifies where to open the linked document. It controls whether the link opens in the same window, a new window, or a specific frame.
<!DOCTYPE html>
<html