Link Tag Or Anchor Tag

link tag :

link tag is all in all for a web site.  All web site is a set of links of web page. They contain link from one page to other page. By links a user can enter one page to other page. A link is made by word , group of word, image that you can click on it  and can go to a new doc. When you move your cursor over a link on your page, the arrow will turn into a little  hand. Html link tag are made by <a> tag. You can not make link just using <a> tag. You have to use href attribute for making a link tag.

The link syntax will be like that:

<a href=”URL”>Text of your link</a>

Example:

<a href=”http://h2cweb.net”>Homepage of h2cweb</a>

If you want to creat a new tab by clicking on a link and open it on the new tab, you have to use target attribute and set it “_blank” .

Syntax:

<a href=”URL” target=”_blank”>Text of your link</a>

 

Create a link with an image: If you know how to work with html image tag than it is very easy for you to create a link with an image. If you don’t know about html image tag you must read html image tag article.

Look at this : 

<a href=”http://h2cweb.net”>Homepage of h2cweb</a>

Here I need to remove “Homepage of h2cweb” and set a image. For that I use html image tag article.

The final stntax will be:

<a href=”http://h2cweb.net”><img src=”image link”></a>

A full example: You can see the localhost directory of my pc. I am going to work with the image.html doc and h2cweb.jpeg image. Syntax will be:

<a href="http://h2cweb.net"><img src="h2cweb.jpg"></a>

After entering http://localhost/image.html   address the browser shows this following result.

 

This is a link with image

Make image link

 

 

 

 

 

 

 

 

 

 

 

 

link tag on same page:

Before link on same page , you have to create link on a page. You can do it by “name” attribute.

Syntax:

<a name=”any name”>Your text here</a>

Look at the following syntax and copy it to your notepad and save it as html doc.

<html>
<head><title>same page link</title></head>
<body>
<p>
<a href="#C4">Go to chapter 4</a>
</p>

<h2>Chapter 1</h2>
<p>Hi I am a student of this school. </p>

<h2>Chapter 2</h2>
<p>Hi I am a student of this school. </p>

<h2>Chapter 3</h2>
<p>Hi I am a student of this school. </p>
<p>
<a href="#C8">Go to chapter 8</a>
</p>
<h2><a name="C4">Chapter 4</a></h2>
<p>Hi I am a student of this school. </p>

<h2>Chapter 5</h2>
<p>Hi I am a student of this school. </p>

<h2>Chapter 6</h2>
<p>Hi I am a student of this school. </p>

<h2>Chapter 7</h2>
<p>Hi I am a student of this school. </p>

<h2><a name="C8">Chapter 8</a></h2>
<p>Hi I am a student of this school. </p>

<h2>Chapter 9</h2>
<p>Hi I am a student of this school. </p>

<h2>Chapter 10</h2>
<p>Hi I am a student of this school. </p>

<h2>Chapter 11</h2>
<p>Hi I am a student of this school. </p>

<h2>Chapter 12</h2>
<p>Hi I am a student of this school. </p>

<h2>Chapter 13</h2>
<p>Hi I am a student of this school. </p>
</body>
</html>

Output:                   Preview this on your browser

Roy Jemee is a professional Blogger. Apart of blogging he likes to play with mathematics. He knows Blogging, Wordpress, PHP, javascript , SEO and some other.