More on Hyperlinks...
You can use links to take you to:
1. A target somewhere in the same document
2. Another document stored on the computer you're working on
3. A document on another computer connected via the Internet
We'll take each of these in turn...
1. Suppose, for example that your menu.htm document was quite a long one and you wanted people to be able to jump to a particular part of it - let's say to a section on 'Main Courses'. In your menu.htm document, you need to set up a target at the appropriate place. It would look something like this:
<A NAME="main courses"></A>
...and you would place this target just before the paragraph, or text, which describes the 'main courses'.
So if you wanted to 'jump' from somewhere else in the document to the target at the 'main courses' section, you'd have a link in it something like:
Click here to see <A HREF="#main courses"> Alice's main dishes </A>
- note the '#' sign and note also that you must spell 'main courses' exactly as it appeared in the target description - you are, however, allowed to use spaces in the name...
Of course, the menu.htm document that you have isn't big enough for you to be able to check that this actually works. One way around this would be to copy and paste a few paragraphs of text from somewhere - it doesn't matter what it's about - so that your document is a reasonable size. Put the 'main courses' target somewhere near the end of the document and the link to it from somewhere near the start of the document.
- follow the instructions above and check that the link works
2. To do the same thing, but starting from within a different document you must supply the name of the document that you want to link to like this:
Click here to see <A HREF="menu.htm#main courses"> Alice's main dishes </A>
If you miss out the target name like this...
Click here to see <A HREF="menu.htm"> Alice's main dishes </A>
...then it will simply take you to the top of the menu.htm document as you've seen already.
- set up a link in your cafe.htm document which will take you to the target at the 'main courses' section in the menu.htm document
3. Any document accessible via the Internet has its own address called a Uniform Resource Locator, or URL. For example, the Uffizi Art Gallery in Florence, Italy has a website and if you wanted to put a link in your document which connects to it, you would need a line something like:
Click here for the <A HREF="http://www.uffizi.it/">Uffizi Gallery</A>
OK, enough of that, it's your turn now...
- as an exercise, we'd like you to try the following:
"We'd like you to develop the menu page to show a few of the menu items and their prices. Choose some dishes - carrots and custard, or whatever - and put them on your page. Can you arrange it so that the prices appear lined up underneath each other?
This is not a trivial task so don't be surprised if the results are not what you expected and don't spend too long on it."
You should have discovered that getting the layout to look as you want it to look can be a frustrating business using only what we have learnt so far. We'll return to this shortly but first let's brighten things up with a little colour...
|