HTML links
It is a connection from one web resource to another page and web .we can click on a link and jump to another document and web.
Note :- A link can be an image or any other HTML element .
HTML Link - Syntax :
We also know the html link tag as an anchor and Hyperlink tag. Hyperlinks are defined with the HTML <a> tag:
<a href="url">link tag example</a>
Example :
<!DOCTYPE html>
<html>
<body>
<h2>HTML Hyperlink and anchor </h2>
<p> <a href="http://www.stackoverlode.com">Visit StackOverlode</a> </p>
</body>
</html>
The href is a attribute specifies the destination address (http://www.stackoverlode.com) of the link.
Links in html are of two types.
- Internal Hyperlinks
- External Hyperlinks
Internal Hyperlinks
An internal link is a type of hyperlink on a webpage to another page or resource, such as an image or document, on the same website or domain.
External Hyperlinks
An External link is great future to drive a webpage one to another and useful for surf many web page in website.
Example : -
<!DOCTYPE html>
<html>
<h3>Internal Hyperlinks And External Hyperlinks Example</h3>
<body>
<p><a href="demo.html">Internal</a> It is a link to the contribute page on stack overlode ' website.</p>
<p><a href="https://www.stackoverlode.com/">External </a> It is a link to the Stack Overlode website on the World Wide website.</p>
</body>
</html>
The target and Attribute in HTML Links
The HTML target attribute specifies where to open the linked document web and image.
There are few targets in HTML attribute can have one of the following values:
Target Attribute | Description |
---|---|
_blank | Opens the linked document in a new tab or window. |
_parent | Opens the link in the parent frame. Frames are deprecated in HTML5. |
_self | Open the link in the current frame. |
_top | Opens the link in the top-most frame. Frames are deprecated in HTML5. |
This example will Opens the linked document in a new tab or window. :
This example will Opens the link in the parent frame. Frames are deprecated in HTML5 :