In this tutorial we are going to learn how to make a link in html
Links are used to move from one page to another page in web or from one website to another website.
There are many types of links like:
Link from one page to another page on same website.
Link from one website to another website.
Link to open new window.
Link that can start up email program and address a new email to someone.
Let start today tutorial
how to make a link in html
Link are created by using <a> anchor tag . <a> tag has href attribute ,in href you
specify page’s or site’s url , you go when you will click on him.
<a href=”url”> Display Link Text </a>
HTML href Example
Here href attribute specify link you want to go .
HTML href Example code
When someone will click on it , link will move him on this site. Here vu-help.com are link’s text which will display on link.
HTML Link Code:
<h3>html link tag</h3> <a href="https://vu-help.com">VU-HELP.COM</a>
You can observe above mentioned scenario in Output.
Complete HTML Link Code :
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Link In HTML</title> </head> <body> <h3>html link tag</h3> <a href="https://vu-help.com">VU-HELP.COM</a> </body> </html>
how to make a link in html in same webpage
You can link webpage link in same website , when you are linking pages within same website , you don’t need to specify domain name in url.
It is also know as relative url . if all pages of site are in same folder , then you can use name of file as href attribute . but if site have different kind of pages , then you indicate where the pages is in relation to the current page.
To create email start up program , when user click on it a start up program open and email is send to specific email address , you use <a> element , but this time you must identify value of href attribute with mailto attribute and email address of person you want to setup.
<a href=”mailto:[email protected]”> Mail me </a>
Now see in output an email link looks like a normal link but when you will click on it an email program will be open , and prompt to you enter a email.
how to make a link in html to Open a link in new window
If you want a link in your site that will be open in new window when user click on it. Use the target attribute on opening <a> tag. For that Value of attribute should be _blank .
<a href="url" target="_blank">Display text on link</a>
<a href="https://vu-help.com/" target="_blank">Click on link, this will open in new window</a>
When you click on it , vu-help.com Site will be open in new window.
HTML Link Code
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Untitled Document</title> </head> <body> <div style="margin-left:40px"> <a href="https://vu-help.com/" target="_blank">Click on link, this will open in new window</a> </div> </body> </html>
How to link a specific part of same page?
If your page contains with large contents , user will scroll down whole page to up and down in page to looks page’s contents but using links in same page you can save user time to scroll down and up. To link a specific part of page , first things is you need to identify points in page that link will go to. You can do this with id attribute . value of id attribute should only start with a letter or an underscore also two id attribute should not have same value. For id attribute you use <a> tag and value of href attribute starts with hash (#) symbol , followed by value of id attribute you want to link.
download this source file and run it to check how it work.
you have learnt how to create a link in html .
links are created with <a> tag and <a> tag use href attribute to indicate page you are linking .
you can link page in within same website , which is called relative url.
You can also create email program.
You can use id attribute to target element within same page.
If you find any mistake in this article please write us , or you have any question about this article you are always welcome .