Tutorials Tonight
Follow Us


HTML links are also called hyperlink.

HTML links are connected from one webpage or web resource to another. By clicking a hyperlink you jump to another webpage or web resource.

We generally use hypertext (Hypertext is a text within hyperlink) to be clicked upon to go to a new web page.

Note: It is not necessary that a link can only have text. It may be an image, Button or other HTML element too.

HTML link Syntax:

We use <a> tag to define hyperlink.<a> tag is known as Anchor tag:

<a href="https://www.tutorialstonight.com/">Click here</a>

Click <a href="https://www.tutorialstonight.com/">here</a> to go to Homepage
▶ Run the code

Syntax explanation:

  • href is attribute of anchor tag and is used to give destination of link
  • Content in between opening and closing of <a> tag is clickable and visible part of hyperlink

Apart from href attribute there are other attributes too.

  • HTML Link - target Attribute
  • HTML Link - title Attribute

Let's discuss these attributes.

HTML Link - Target Attribute

target attribute is used to specify where the linked document should be opened. Whether it will open in the same tab or on a different tab.

This attribute has following values:

  • _self - It opens the linked document to the same tab.It's also default value.
  • _blank - It opens the linked document to a different tab or window.
  • _parent - It opens the linked document in the parent frame.
  • _top - It will open the linked document in the full body of the window.

Here is an example and you can change different values to see the difference in the practice section.

Click <a href="https://www.tutorialstonight.com/" target="_blank">here</a> to go to Homepage
▶ Run the code

HTML Link - title attribute

title attribute provides additional information about HTML link.When user takes its cursor over the link then value provided for title attribute is shown in a box.

Click <a href="https://www.tutorialstonight.com/" title="Go to Homepage">here</a> to go to Homepage
▶ Run the code

Image as Hyperlink

As mentioned above we can use image also as HTML link.Here is an example:

This image is <a href="https://www.tutorialstonight.com/"><img src="flower.jpg"></a> to go to Homepage
▶ Run the code

HTML Link - Bookmark

You can also use HTML links to create bookmarks on the same web page. Clicking on the link will instantly take you to that part of the web page.

Here is an example that will take you to HTML link syntax.

click here to jump to HTML link syntax.

Here is how to create a web page bookmark.

  1. First create an id to the part of the web page where you want to jump.

  2. <h4 id="bookmark1">HTML Link syntax</h4>
  3. Now in <a> tag provide href value="#id_name"

  4. <a href="#bookmark1">Go to HTML Link syntax</a>

Follow Us