How to Create a Link / Hyperlink

Navigation

Sponsors

How to Create a Link / Hyperlink

Save this to Del.icio.us

The Basics

Creating links between content is something that all webmasters must learn how to do, as the internet is all about going from one page to another. The correct terminology for links is in fact "Hyperlinks", and it is coded using the <a> tag.

Let us look at a link is actually coded:

HTML
<a href = "Destination URL">Anchor Text</a>

Result
Anchor Text

HREF

"HREF" is in fact an acronym for "Hypertext REFerence" and is used to define the location the visitor is sent when they click on the link. It is used in the form 'href = "Destination URL"', where the "Destination URL" is the location the visitor is send to. The "Destination URL" can be defined as a relative or absolute location.

Anchor Text

The anchor text refers to the text that appears that the visitor can click on. In the above example the anchor text is in fact "Anchor Text", and is shown in blue unlined text.

Image Links

In fact the link does not always have to be via text. As you are probably already aware, you can in fact set an image to link to another resource. This is done by using <a> tags around the <img> tag, as shown below:

HTML
<a href = "Destination URL"><img src = "images/exampleImageLink.png" width = "54" height = "49" alt = "Example Image Link" border = "0"></a>

Result
Example Image Link

Opening a Link in a New Window

You have probably come across links that open a new window when you click on them. This is used by webmasters when linking to external sources in an attempt to keep the visitor on their own website. It can be useful in certain circumstances but should not be overused as this could decrease the visitors impression of your site.

You can specify a link to open a new window by using the "target" attribute. This should be used within the starting <a> tags as shown below:

HTML
<a href = "Destination URL" target = "_blank">Anchor Text</a>

Result
Anchor Text


[ Back to HTML Tutorials ]


| Forums | Search | Donate | Links | Contact | Scripts | Templates |
Copyright © 2008 SiteToolCenter.com

Website Design

Best Viewed With Mozilla FireFox