How to Link Web Pages in HTML


In this tutorial you will learn how to link web pages in HTML and jump from one page to another. A link in HTML is referred to as a hyperlink or an anchor. A hyperlink can be one word, a group of words, or an image to click on to jump to another web page.

Step # 1 – Creating an anchor

The anchor element in HTML is used in linking webpages, hyperlink text or image must be defined between the beginning and the ending tags of the anchor element.
a Click here /a

In order to learn how to link web pages in HTML we use anchors, the most important attribute of the anchor element is h-ref. This is where we reference the destination web page.
a href=”Demo2.html” Click here /a

When a user clicks on the hyperlink, the browser directs the user to the destination web page, the one referenced in the h-ref attribute of that hyperlink. In this case, the browser will jump to Demo2.html when the user clicks on “Click here”.

Jumping to a new page

Step # 2 – Setting a target

HTML also allows you to define where to open a hyperlink. This is done with the target attribute of the anchor element.

a href=”Demo2.html” target=”_self” Click here /a

There are several predefined values to this attribute, for example: _self, _blank, and _parent. The value _self opens the destination web page within the same window, while the value _blank opens the destination web page differently. This value opens the destination web page in a new window, or in a new tab. The result differs on the basis of each browser, operating system, and device.

Opening link in a new window

That’s all we need to know about linking webpages