How to create a Hyperlink in HTML?

A hyperlink or link is a type of text that is created by HTML. As we all know that a website is made up of many pages and all these pages are connected to each other only through HTML links.

This is clicked, the browser takes us to another web page which page will open when you clicked, it is decided by the code of HTML.

The most important attribute of the element is the href attribute, which indicates the link’s destination. The link text is the part that will be visible to the reader.

Types of Links:

  • Unvisited link is blue.
  • Visited link is purple.
  • Active link is red.

METHOD 1: Creating a Hyperlink

Step-1 Open a new document in a simple text editor or in Notepad.
Step-2 Build each item on it’s own separate line.
Step-3 Form the link tag at the place where the tag will need to stand out to the reader.
Step-4 Locate the place in between the two quotation marks and place your exact link URL there.
Step-5 Title your link on what people should use to click on.
Step-6 Save your file with a .html extension and open it in a web browser to view your results.

METHOD 2:Creating a Hyperlink in HTML Link the text to Another Page

Step-1 Type the Html code in any text editor or open the existing Html file in which we want to add the link of another Html page.
Step-2 Move the cursor at the starting of that text which we want to create as a link.
Step-3 Type the anchor tag at that point and close the anchor tag at the end of that text.
Step-4 Type the href attribute within the starting tag.
Step-5 Save the Html code and run the code.

METHOD 3: Link the text to section on the same page

Step-1 Create a HTML code and place the cursor at the starting of that section you want to add link.
Step-2 Use the anchor tag with the id attribute. Step-3 Place the cursor at the starting of that text and type the anchor tag at that point. Step-4 Close the anchor tag at the end of that text.
Step-5 Type the href attribute within the starting tag.
Step-6 Save the Html file and then execute the file.