HTML Links


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:

ValueExplanation
_blankIt opens the linked document in a new tab or window.
_parentIt opens the linked document in the parent frame.
_selfIt opens the linked document in the same window.
_topIt opens the linked document in the full body of the window.

Example

Let us see an example of HTML Links −

Live Demo

<!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.

Updated on: 17-Feb-2021

474 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements