It's a tag again. But its a little more complex than the last one.
<A HREF="path/file.htm"> The text you want to be the link </A>
Which would look like The text you want to be the link on the page.Ok. lets look at that in detail. First it has an and off elements (<A....> and </A>) which mark the start and the end of the link.
Then it has a part that tells the browser what file to go to. (HREF="path/file.htm") Now this is the bit that is going to cause head aches.
Sorry but I did say I wouldn't lie to youOf there are 2 types of URL's (URL;s are the bits that can go in that "path/file.htm" section)
- Relative URL's
- These are where the file is in relation to the file you are currently looking at. If there are in the same directory all you need to include is the filename.
E.g. <A HREF="colour.html"> from this page would take you back to the previous page where we talked about colours.
If they are not in the same directory then you need to tell the browser how to find it.
E.g.<A HREF="examples/exp1.htm" > would look for the sub-directory called examples and open the file exp1.htm it should find here. E.g.<A HREF="../index.html"> will take you back to the aria.uk.com main introduction.
the "../" bit says to the browser "Go up a directory". Actually its a little more complex than that, but for basic HTML that is all you need to know.
Also <a href="../webmaker/index.html"> which tells the browser to go up a directory and then find the webmaker directory and open the index.html file in that one.- Absolute URL's
- These tell the browser the exact universal location of that page.
E.G. <A HREF="http:\\www.aria.uk.com">
No matter where the original file is these links will always lead to the same place.
There are a couple of bits to note in this. The "http:\\" bit tells the computer that this is a Hyper Text transfer protocol- In other worlds it is going to find a html page at the end of this link.
There are other things than can appear here such as "ftp:\\" (file transfer protocol) and "mailto:" which opens an e.mail window.
In fact that last one is very useful. Some where on your site you should have a way for people to contact you for further information, or to tell you that there is a problem with the site.
<A HREF="mailto:you@yourprovider.Whatever">Mail me</A>
Will allow them to do just that easily
e.g.mail webmaster@aria.uk.comBoth of these systems have their advantages and disadvantages. Relative URL's are almost essential when you are building your web pages, other wise once you up loaded your site to your web space you would have to change all the names.
Absolute URL's are essential when you are referring to files on a completely different site, where climbing up and down directories would be impossible.The dreaded error 404
When you call to a location that does not exist this is what you get back. It basically means that the browser could not find the file you just sent it to. You will see these because life is like that. All you can do is check the spellings. Remember "A" is not the same as "a" for some browsers (This is called syntax sensitive) so you have be careful with your names.
The other source of problems is the .htm and .html extension (which tells the computer what type of file the file is)
Both are perfectly valid. At aria.uk.com we use .htm for 'plain' files and .html for files including Javascript or some other fancy clever DHTML or something.
To be safe pick one and stick with it.There are programs available that check to see if links are 'broken' - that is do not lead anywhere and result in a 404 error. These are well worth using as there is nothing more irritating when you are browsing to discover the really interesting link you want to use no longer goes anywhere! Unfortunately these is all too frequent as people university sites are closed down, and people move service providers and thus change their URL's.
As web master of your site you ow it to your 'public' to check your links still work. (Personal opinion only)Ok. Rant over
Now you know how to take people to other pages on the World wide web.
Want a quick tip on how to make them come back?
<A HREF="path/file.htm" target=_blank>
What the target=_blank does is opens a whole new browser window for the new page. There are other "target=_x" but there is no need to go into them here as they are mainly used form more advanced websites
Use it sparingly or the people using your site will end up with far too many windows open, but for links off your site to other peoples sites it can be very useful. And people can always close down the extra window if they want.Ok so we have text, links, different colours..
I suppose you'd like to do images as well