TheWebsEye.com HTML tutorial



HTML TUTORIAL HTML EDITORS HTML BOOKS HTML RESOURCES



HTML Links

In HTML, a hyperlink is created with the <A> tag. This can have two attributes, either href or name.

open online HTML editor
Online editor Works only in IE - If you use another browser you can Download Web Page Teacher.

<a href="xxx">Click here</a> - this specifies the url of the page that you want to link to. This can be relative or absolute.

An absolute url is the complete url of the destination page. For example <a href="http://www.TheWebsEye.com/HTML//index.htm">HTML-tutorial</a>

A relative url shows the path to the destination url relative to the current page.

  • If this is in the same directory as the current page the link would look similar to:
    <a href="home.htm">Home page</a>.
  • If the link is in the root folder of the website you preceed the name of the page by a "/", for example:
    <a href="/home.htm">Home page</a>
  • If the link is in one folder above the current folder, you preceed the name of the page by a "../", for example:
    <a href="../home.htm">Home page</a>
  • If the link on the same page you preceed the name of the link by a "#", for example:
    <a href="#name_of_link">Top</a> where name_of_link is the name of the anchor (see below)

<a name="name_of_link"></a> - this specifies the name of an anchor on the same page. It does not need to contain anything, but is used as an identifier

The other thing you should know about links is that you can specify whether the destination url opens in a new wndow. If you want to open a new window you need to add a target - for example:
<a href="http://www.TheWebsEye.com/HTML/" target="_blank">Click here</a>