HTML uses a hyperlink to link to another document on the Web

The Anchor Tag and the Href Attribute

HTML uses the <a> (anchor) tag to create a link to another document.
An anchor can point to any resource on the Web: an HTML page, an image, a sound file, a movie, etc.
The syntax of creating an anchor: 

<a href="url">Text to be displayed</a>

The <a> tag is used to create an anchor to link from, the href attribute is used to address the document to link to, and the words between the open and close of the anchor tag will be displayed as a hyperlink.
This anchor defines a link to W3Schools:

<a href="http://www.kbcc.cuny.edu/">Visit KCC!</a>

The line above will look like this in a browser:
Visit KCC


The Target Attribute

With the target attribute, you can define where the linked document will be opened.
The line below will open the document in a new browser window:

<a href=http://www.kbcc.cuny.edu/ target="_blank">Visit KCC!</a>

 


The Anchor Tag and the Name Attribute

The name attribute is used to create a named anchor. When using named anchors we can create links that can jump directly into a specific section on a page, instead of letting the user scroll around to find what he/she is looking for.
Below is the syntax of a named anchor:

<a name="label">Text to be displayed</a>

The name attribute is used to create a named anchor. The name of the anchor can be any text you care to use.
The line below defines a named anchor:

<a name="tips">Useful Tips Section</a>

You should notice that a named anchor is not displayed in a special way.
To link directly to the "tips" section, add a # sign and the name of the anchor to the end of a URL, like this:

<a href="http://www.kbcc.cuny.edu/html_links.html#tips">
Jump to the Useful Tips Section</a>

A hyperlink to the Useful Tips Section from WITHIN the file "html_links.html" will look like this: 

<a href="#tips">Jump to the Useful Tips Section</a>

 

Named anchors are often used to create "table of contents" at the beginning of a large document. Each chapter within the document is given a named anchor, and links to each of these anchors are put at the top of the document.
If a browser cannot find a named anchor that has been specified, it goes to the top of the document. No error occurs. 

Open a link in a new browser window
this example demonstrates how to link to another page by opening a new window, so that the visitor does not have to leave your Web site.

<a href="lastpage.htm" target="_blank">Next Page</a>

<p>
If you set the target attribute of a link to "_blank",
the link will open in a new window.
</p>

Next Page

Link to a location on the same page
This example demonstrates how to use a link to jump to another part of a document.

<p>
<a href="#C4">See also Chapter 4.</a>
</p>

<h2>Chapter 1</h2>
<p>This chapter explains ba bla bla</p>

<h2>Chapter 2</h2>
<p>This chapter explains ba bla bla</p>

<h2>Chapter 3</h2>
<p>This chapter explains ba bla bla</p>

<h2><a name="C4">Chapter 4</a></h2>
<p>This chapter explains ba bla bla</p>

<h2>Chapter 5</h2>
<p>This chapter explains ba bla bla</p>

<h2>Chapter 6</h2>
<p>This chapter explains ba bla bla</p>

<h2>Chapter 7</h2>
<p>This chapter explains ba bla bla</p>

<h2>Chapter 8</h2>
<p>This chapter explains ba bla bla</p>

<h2>Chapter 9</h2>
<p>This chapter explains ba bla bla</p>

<h2>Chapter 10</h2>
<p>This chapter explains ba bla bla</p>

<h2>Chapter 11</h2>
<p>This chapter explains ba bla bla</p>

<h2>Chapter 12</h2>
<p>This chapter explains ba bla bla</p>

<h2>Chapter 13</h2>
<p>This chapter explains ba bla bla</p>

<h2>Chapter 14</h2>
<p>This chapter explains ba bla bla</p>

<h2>Chapter 15</h2>
<p>This chapter explains ba bla bla</p>

<h2>Chapter 16</h2>
<p>This chapter explains ba bla bla</p>

<h2>Chapter 17</h2>
<p>This chapter explains ba bla bla</p>

See also Chapter 4.

Chapter 1

This chapter explains ba bla bla

Chapter 2

This chapter explains ba bla bla

Chapter 3

This chapter explains ba bla bla

Chapter 4

This chapter explains ba bla bla

Chapter 5

This chapter explains ba bla bla

Chapter 6

This chapter explains ba bla bla

Chapter 7

This chapter explains ba bla bla

Chapter 8

This chapter explains ba bla bla

Chapter 9

This chapter explains ba bla bla

Chapter 10

This chapter explains ba bla bla

Chapter 11

This chapter explains ba bla bla

Chapter 12

This chapter explains ba bla bla

Chapter 13

This chapter explains ba bla bla

Chapter 14

This chapter explains ba bla bla

Chapter 15

This chapter explains ba bla bla

Chapter 16

This chapter explains ba bla bla

Chapter 17

This chapter explains ba bla bla

Break out of a frame
This example demonstrates how to break out of a frame, if your site is locked in a frame.

<p>Locked in a frame?</p>

<a href="http://www.kbcc.cuny.edu/"
target="_top">
Click here!</a>


Locked in a frame?

Click here!

Create a mailto link
This example demonstrates how to link to a mail message (will only work if you have mail installed).

<p>
This is a mail link:
<a href="mailto:someone@microsoft.com?subject=Hello%20again">
Send Mail</a>
</p>

<p>
<b>Note:</b> Spaces between words should be replaced by %20 to <b>ensure</b> that the browser will display your text properly.
</p>

This is a mail link: Send Mail

Note: Spaces between words should be replaced by %20 to ensure that the browser will display your text properly.

Create a mailto link 2
This example demonstrates a more complicated mailto link.

<p>
This is another mailto link:
<a href="mailto:someone@microsoft.com?cc=someoneelse@microsoft.com&
bcc=andsomeoneelse2@microsoft.com&subject
=Summer%20Party&body=You%20are%20invited
%20to%20a%20big%20summer%20party!">
Send mail!</a>
</p>

<p>
<b>Note:</b> Spaces between words should be replaced by
%20 to <b>ensure</b>
that the browser will display your text properly.
</p>



This is another mailto link: Send mail!

Note: Spaces between words should be replaced by %20 to ensure that the browser will display your text properly.