The HTML Links are hyperlinks that means when you click on a link, it jump son another document.
Syntax
Following is the syntax −
<a href=”URL” target=”value” >Link Content</a>
Here URL specifies the destination address and it can be either local or external address. target attribute defines where to open the linked document and it can take the following values:
Value | Explanation |
---|---|
_blank | It opens the linked document in a new tab or window. |
_parent | It opens the linked document in the parent frame. |
_self | It opens the linked document in the same window. |
_top | It opens the linked document in the full body of the window. |
Example
Let us see an example of HTML Links −
<!DOCTYPE html> <html> <style> body { color: #000; height: 100vh; background-color: #8BC6EC; background-image: linear-gradient(135deg, #8BC6EC 0%, #9599E2 100%); text-align: center; } </style> <body> <h1>HTML Links Demo</h1> <a href="https://google.com" target="_blank">Go To Google</a> </body> </html>
Output
Now click on “Go To Google” link to open google link in a new window.