HyperLink in HTML


Its short form is link.This is the most powerful feature of HTML.A website consist of a number of webpages.To create a link between this webpages a programmer can used hyperlink tag with the help of this users can easily navigate from one page of the website to another.

Anchor Tag(<a>) :-The anchor tag <a> is used to create a hyperlink on the webpage.This tag gives the body of the webpage’s code.This tag is used to tell the browser from where the link start.Opening tag is used <a> and closing tag is used </a>.Anchor tag has a attribute which are href .The href stand for hypertext reference that contains the URL of the other webpage to which link will move to.for example

<HTML>

<Head>

<Title>anchor tag</title>

</head>

<body>

<a href=”URL”>Hyper-linked text</a><br>

<a href=”h.HTML”>Hyper-linked </a>

</body>

</HTML>

Output:

 

 

 

 

 

 

 

Hyperlink has two types.

(1.)Internal Link

(2.)External Link

(1.)Internal Link :-When we want to create the link within a page then we can use internal link.This link is used to create link on one page.e.g

<HTML>

<Head>

<Title>Internal link of webpage</Title>

</Head>

<body>

<h2 align=”center”>Baby Names</h2>

<a name=”top”</a>

<a href=”#a”>A</a>

<a href=”#b”>A</a><br><br>

<a name=”a”>A

<hr>

Arun<br><br>

Anmol<br><br>

<br><br>

<a href=”#top”>top</a>

<br><br><br>

<a name=”b”>B

<hr><br>

Bharat<br><br>

Bhupinder<br><br>

<a href=”#top”>top</a>

<hr>

</body>

</HTML>

Output:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

(2.)External Link :-When we want to create link in two different pages then we can use external link with the help of this link we can click on one page and go to another page.

 

<HTML>

<Head>

<Title>External link of webpage</Title>

</Head>

<Body>

<a href=”h.HTML”>goto</a>

</Body>

</HTML>

Output:

 

 

 

 

 

 

When click on goto then “h.html” file is open.

Comments are closed.