Lesson Two

HTML becomes much more interesting when you want to link different pages together. You can put special bits of HTML into the text of your document containing the names of other pages, and the browser will create links to those pages. These take the form: <a href="pagename.html">. The text placed between that tag and the closing tag </a> will be used as the underlined piece of text which forms the visible link on the page that invites the reader to click on it. When you view the source code of this page you will be able to see the HTML around the following underlined bit of text: link example. If you click on it when viewing the source code it will do absolutely nothing, but when you click on it in the browser it will jump to another page, and when you click on the "back" arrow you will probably find that the link has changed colour: it does this to tell you that you've already explored that link. It is possible to state a colour in a link so that it doesn't get "dinged" afterwards, and I have done that here with this alternative link to the same page: link example. This enables you to preserve the look of a page which people are expected to return to many times and to click on the same links on each occasion. Here is a third link which doesn't jump to another page: jump. Click on it and see where it takes you.

You may have noticed that I have used the special codings &lt and &gt in the source code to display examples of tags in the visible document: if I had used actual less-than and greater-than signs in the source code they would have tried to become real tags and would have been invisible when viewing from the browser, hiding the content in between them in the process. I have also had to put <a/> between & and lt/gt in this paragraph so that I can show you these special codings without them turning into less-than and greater-than signs when viewed from the browser.



It is also possible to link to other parts of the same page. To do this you need to plant a name in the source code of the page at the point you want to jump to, and in this example I have put in the name "here" at the top of this paragraph. Use the up-cursor key to run back up to the top and you will see that you are still viewing the same page. If you click on the link again, you will find that the back arrow can also jump within the same page.

Now click on either of the first two links on this page and hunt for a hidden link on the page they jump to: the hidden link has been written using white text so that you can only see it if you put the cursor on top of it. Click the hidden link and see where that link takes you to.

























































If you've just jumped here from a hidden hyperlink, use the up-cursor key to find out where you are now. If you look at the html code behind the link that brought you here, you will understand how you can jump to a named point in any of your Web pages from any part of any other page in your Web site.

The <br> tag is used to break to the next line, and it can be used repeatedly to create a long empty space in a page.