
= Beginner
= Average
= Advanced
What is a link?
A link generally appears in a web page as an underlined explicative text, in a contrasting color. Clicking on it will open the corresponding page.
That short definition explains what you must give to your editor in order to create a link:
_the explicative text (hightlited)
_the URL (the destination page)
To enable the access to your other HTML files, you will need to insert links toward them in your index file. (Readers will NOT want to type in their browser control area long filenames: they will only use the mouse... or quit.)
Where can you insert links and to where?
You can insert links, toward other files, in any HTML file.
Your index.html file MUST be used as an ... index, as its name underlines. (Well... if you have only one section in your web page, you don't need links, but just have to put it in your index file. However, is that really serious?)
In order to make the divisions in your page stand out, you can materialise them by creating subdirectories, where you will put the relevant files. It will also make easier the management of your page, since you won't have to take into account files having noting to do with the section you are currently working on. You can even include index files in each subdirectory.
The URL to get to these files, say, in the subdir directory, will look like:
http://www.server.extension/login/subdir/filename.html (for any file, including the index)
or
http://www.server.extension/login/subdir/ (special shortcut for your index file)
As you see, the index.html (or index.htm) filename has a special function: it is the file a browser will automatically get first in any directory.
You can also insert links to other pages, on the same server or others, in the same way. A good way to be sure of the link you will use is to get to it with your browser, and just copy the address you read in the control area.
The use of local references
When you insert links in an index (or in any other HTML file), to go to your own files, you can choose to write only a part of the address. For instance, to get to a file named myfile.html, from a HTML file in the same directory, you can use the address:
To get to a file in a subdirectory of the current one, it would be:
To get up in the filesystem, you can use:
It is really usefull when creating a link that gets you back to the main index, from a subdirectory. For instance, you could write a link, with the explicative text "Back", in a file.html file in the subdirectory subdir, to get back to the main index. The location you would have to give would then be ../ (yes, that's all!).
If local references enables you not to write the complete reference (you don't even have to write the http:// header) it is also usefull with complex filesystems, with numerous subdirectories. If you use this system, you can move whole subdirectories without having to change addresses in your html files, even if it has subdirectories. You will just need to change addresses referring to files that are NOT in this subdirectory, which practically means only the main index, if you only have created "Back" links as above.