How To Link One Page To Another In HTML
Last Updated : Jan 1, 2023
IN - HTML
In this tutorial we will show you the solution of how to link one page to another in HTML, sometimes, we found on internet that there are some websites or webpages.
In which there is a link or button and when we click on that then webpage gets changed, this is done with the help of HTML links. In this we link one webpage to another webpage.
We are able to redirect user from one webpage to another webpage.
Step By Step Guide On How To Link One Page To Another In HTML :-
As, we discuss earlier that linking of one or more webpage is possible through with the help of HTML links. By using HTML links we are able to go next to next webpage as we want.
Here, an anchor is used in HTML for this job, in which its hyper-reference (href) attribute used.
We give the webpage name or its location with name of webpage with its extension as value. Here is a general use of anchor tag to link webpages with the help of codes is given here...
<!DOCTYPE html> <html> <head> <title> Title of the document</title> </head> <body> <a href=" pagename.extension"> Click me </a> <a href="http://www.google.com/"> This syntax is used to link online webpages </a> </body> </html>
- First, we write <! DOCTYPE html> which we used as an instruction to the web browser about what version of HTML file is written in.
- Secondly, the <html> tag is used to indicate the beginning of an HTML document.
- 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.
- Thirdly, <body> tag is used to define the webpage body. All the contents to show on website are written here.
- Here, in the code in between body tag we use two anchor tags. At First, anchor tags are paired tags so it must have closing tag.
- The text written in between these tags in shown on screen and as default its color is blue and also underlined. Now, the link to another page is given by using an attribute href to anchor tag and the page name and its extension is given as value to this attribute.
- In second anchor tag, https// is used, if u want to provide an online link means that it the page where you want user to go is already on internet, then link starts from www… is given after this https//.
- At last, the <body> and <html> tags are closed with </body> and </html> respectively.
At last, here we can say that linking one page to another is not a difficult process. A page in linked to another page in different ways, which we discuss later, like in forms and as a button etc.
Anchor tag is the easiest way to link a webpage to another webpage. It is not mandatory that you can link one page to another one only.
You can also link one webpage to two or more than two webpages as you want. I hope this tutorial on how to link one page to another in HTML helps you.