All TalkersCode Topics

Follow TalkersCode On Social Media - A Social Media Network for developers Join Now ➔

How To Create A Link To A Website In HTML

Last Updated : Mar 11, 2024

How To Create A Link To A Website In HTML

In this tutorial we will show you how to create a link to a website in HTML, in HTML, there is a feature with the help of which you are able to link one html page to another html page. We all know that a website is a collection of webpages.

And webpages are mostly made with the help of html. Hence when we link html file to another html file, then in actually we link one website to other or one website to html page or vice versa.

Step By Step Guide On How To Create A Link To A Website In HTML :-

As, to link a website to another we have to write some codes in html file. For this we have to use a tag named as anchor tag, it represents in html with <a>.

It is a paired tag and the text that we write in between the tags is showed on webpage or browser. Now, there are some additional attributes that are used in anchor tag to make a link.

And when we click on text showed on browser that we write in between tags it redirects user to another html page or website.

Here is an example of the codes, with the help of which you can understand how it works.

<!DOCTYPE html>
          <title> Title of the document<title>
		<a href="">
        	Click me!
	        by clicking on this link, google home page gets opened.
  1. First, we write <! DOCTYPE html> which we used as an instruction to the web browser about what version of HTML file is written in.
  2. Secondly, the <html> tag is used to indicate the beginning of an HTML document.
  3. As above now <head> tag is used to contain information about web page. In this tag a <title> tag is used which helps us to specify a webpage title. Both <head> and <title> tags are Paired tags. So, both have </head> and </title> ending tags respectively.
  4. Thirdly, <body> tag is used to define the webpage body. All the contents to show on website are written here.
  5. In the body tag, here we first create an anchor tag in which we write Click me! The text is showed on the webpage when you open this page on your browser and appears blue in color with an underline and then we use h2 tag, the text written in this tag appears link heading because it is heading tag.
  6. Now, the concept is that, we create href attribute within opening tag of anchor tag, as we know all the properties are applied here.
  7. Now, href is hypertext reference and in the value you have to give the link of website, which we want. For example we give here the link of and you can also paste the link which you copied from any other webpage or website.
  8. At last, the <body> and <html> tags are closed with </body> and </html> respectively.

Conclusion :-

In conclusion, here we can say that in html we are able to link a website to another with the help of anchor tag.

We can also link any online website and also the website from our local folder here.

There are some properties of target in anchor tag, that we show you in our next session. I hope this tutorial on how to create a link to a website in HTML helps you and the steps and method mentioned above are easy to follow and implement.

Author Image About Riya

A recent graduate with a Bachelor of Technology (B.Tech) in Computer Science from India. She is passionate about leveraging technology to solve real-world problems. With a strong foundation and experience in programming languages such as Python, Django, HTML, CSS, and JavaScript, java, php and have honed her skills through hands-on projects and coursework.

Follow Riya On Linkedin 🡪