Published on: 2006-04-28 - Views: 5155

Digg! del.icio.us Furl reddit spurl bloglines ma.gnolia.com Yahoo MyWeb technorati blogmarks blinklist pixelgroovy Share this tutorial on tutorialicio.us! simpy
HTML Links are the basical entity of hypertextual navigation.
There are several kinds of links. Standard links are used to send the visitor to another page that can be located under the same domain or in another domain. These links can be relative or absolute: relative links are specified starting from the actual page location on the server and absolute links include the full URL of the linked page.

This is an example of a relative link to another page of this site, in the same folder as this page:
<a href="custom_error_htaccess.php" target="_blank">Custom Error Pages with .htaccess</a>
This link is relative as well but points to a page contained in another folder; the ../ specifies that the path of the document starts from the superior directory:
<a href="../php-mysql/basic_random_image.php" target="_blank">Generating Random Images</a>
This link is absolute, you just have to specify the full URL of the page you are linking to:
<a href="http://www.tutorialstream.com/" target="_blank">TutorialStream</a>
You'll have noticed that there's a target attribute, it's used to specify where the destination page will be displayed:
_self
The page will open in the same tab/window you are using, the actual page will be replaced with the destination one. It's the default one and can be omitted.
_blank
The page will open in a blank new tab/window of your browser, the actual page won't be closed.
_top
Use this if you are in a frameset and want the destination page to take the whole browser window.
_parent
This is really similar to _top, it makes the destination page open in the parent frame area. To be used if you are in a nested multiframe environment.
You can use links also to send the visitors to specific section of your page: say you have a really long page and want to split it in several directly reachable sections without creating separate pages, well you can add anchors where you want to create break points:
<a name="section1">
and then you can link to the specific section specifying it into the linked URL, in this way the linked page will scroll until the destination section is displayed:
<a href="page.html#section1" target="_self">Section 1</a>
Another genre of link is the email link, with this kind of link when a visitor clicks it will result in his mail client to open a new email message with a precomipled recipient (or more than one), subject and body. If you don't specify these fields they will be empty.
<a href="mailto:you@yourdomain.com?subject=Your Subject&body=Blah Blah Blah?">Send me a message!</a>
If you want to send the email to multiple addresses just put a comma between them.