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

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.

Syntax:

1

<ahref=”url”>Display Link Text</a>

HTML href Example

Here href attribute specify link you want to go .

HTML href Example code

1

<ahref=https://vu-help.com/>vu-help.com</a>

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:

1

2

3

<h3>html link tag</h3>

<ahref="https://vu-help.com">VU-HELP.COM</a>

You can observe above mentioned scenario in Output.

Complete HTML Link Code :

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

<!DOCTYPE HTML>

<html>

<head>

<meta http-equiv="Content-Type"content="text/html; charset=utf-8">

<title>Link InHTML</title>

</head>

<body>

<h3>html link tag</h3>

<ahref="https://vu-help.com">VU-HELP.COM</a>

</body>

</html>

output

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.

Email link

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.

Syntax :

1

<ahref=”mailto:m.sufyan00765@gmail.com”>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 .

Syntax:

1

<ahref="url"target="_blank">Display text on link</a>

Code:

1

<ahref="https://vu-help.com/"target="_blank">Click on link,thiswill open innewwindow</a>

When you click on it , vu-help.com Site will be open in new window.

HTML Link Code

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

<!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">

<ahref="https://vu-help.com/"target="_blank">Click on link,thiswill open innewwindow</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.