Home

Table of
Contents


Editors

Tags

Text
Formatting


Entities

Links

Frames

Tables

Lists

Forms

Images

Backgrounds

 



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.

Creating Links


The Target Attribute

With the target attribute, you can define where the linked document will be opened.

Image Links

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 specified section on a page, instead of letting the user scroll around to find what he/she is looking for.

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">Read the Useful Tips section</a>

You should notice that a named anchor does not display in a special way.


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

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

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

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