HTML allows us to link one web page with another. The text that provides such linking is known as "Hypertext" and the link is known as "Hyperlink".
<A> ... </A> is used for linking web pages.
We add the address or path in a hyper link by using HREF. This can be a file name of the current directory , any other directory with path or a URL of website in internet or intranet.
This is the text which is connected with hyperlink and points to further references. This part of the text is also known as anchored text.
<a href='http://www.plus2net.com'>More on plus2net</a>
You can see two parts in above code is highlighted, http://www.plus2net.com is the hyperlink and the text part saying More on plus2net is hypertext or anchored text.
We can keep a local file name as hyperlink like this.
<a href='test1.htm'>go to test1.htm</a>
In above code test1.htm file is present in the current working directory
Linking to files in different directory
To move to one step up in current directry we have to use ../ in our path. Here is a sample
<a href='../test1.htm'>go to test1.htm</a>
Same way we can move to two step up or parallel directry by giving relative path address.
<a href='../../another_dir/test1.htm'>go to test1.htm</a>
The above path are considered as relative linking ad we are defining path from the current working file location. We can also link by giving absolute path starting from the root.
<a href='H:\html_files\my_dir\test1.htm'>go to test1.htm</a>
Portability is a big issue if you are using absolute path to link your files. If you want to shift all your files to different drives or different path then all links present inside the files are to be modified and to be given new absolute path starting from drive name. So relative path linking is always better way to link your files as this can work in any location.
Linking to webpage or URL linking
We can use an URL as hyperlink and crate a link to external web site. This can be done from your local file or from any other file located in any website server. Here is an example which links to google.com
<a href='http://www.google.com'>Visit Google</a>
Write one search.htm page and keep three links inside it pointing to google, Yahoo and Bing. Each link should take take you to corresponding search page.
Attributes of <A> ... </A>
href: This attribute specifies the next navigatable page.
link: Used to change the default color of the hyperlink.
alink: Used to change the default color of a hyperlink that is activated.
vlink: Used to change the color of a visited link.