What is a Hyperlink?

A Hyperlink is a hot spot in your document (often just called a "link") that can be clicked with a mouse to access other documents or images on your web site or any other site anywhere. They can appear as text (usually underlined to make it stand out), as an image like a button or a picture representing the destination page.

This how to create a hyperlink from a word, sentence or an image

<a href=...>

This is an Anchor, the start of a hyperlink. The href signifies that this Anchor is a Hyperlink REFerence

"index.html"

This is the name of the file to link to. It goes after the = in the Anchor tag. In this case it is assumed that the file is in the same directory (or folder). See the page on folders.

Home Page

This is the text that will be highlighted as the hyperlink, it is typed after the <a href="index.html"> tag. Make sure the text describes the destination page  in some way, like "Home Page" or "our holiday in Paris" as people may not be sure what to expect if the hyperlink just says "click here".

Alternatively you could type the HTML code for the source of an image that would become the hyperlink, see Images as Hyperlinks.

</a>

This is the end tag for the hyperlink.

The HTML code for a typical hyperlink would look like:

<a href="index.html">Home Page</a>

E-mail Hyperlink

You can also provide a hyperlink to your e-mail address. This link should open the viewers' email program and fill in the "To:" field with your e-mail address. It is best to show your email address as the text in the link so that you can read the address to type it in manually, like this:

<a href="mailto:web@simplehtml.co.uk">web@simplehtml.co.uk</a>

It looks like this in the browser: web@simplehtml.co.uk - click on it, it works ...

Hyperlink to open a page in a new browser window

Sometimes it is preferable to have a hyperlink open the page in a different or new browser window. To do this you just need to add an extra attribute to the <a href=...> tag like this:

<a href="index.html" target="_blank">Home Page</a>

The page, index.html, would be displayed in a new browser window.

  • The target value _blank is a special value, that always means: "open a full, brand new browser window to display the page". In Netscape Navigator 8.1 and FireFox 2 the page will open in a new tab.
  • If you put a different value, e.g.: newwindow the first time the hyperlink is clicked a new window will be opened containing the page. If another link is clicked that has the same target value, the page in this hyperlink will replace the page already in the window.