Quick HTML




Links

Basically, the link function is to move the reading to a target when it is selected:
the target may be another point of the same page, another page or site, or a file.

Link to a web site

The link tag needs always:
  1. a target address
  2. a link name
To link to a web site, the target address must start with the string   http://

For example:
Visit the <A HREF="http://www.nasa.gov">NASA website</A>
Visit the NASA website

Linking pages together

A number of HTML files can be joined as book pages using links.
In fact, you can think to a web site as to a book.

See, for example, these two HTML documents, one.htm and two.htm.
one.htm has a link to two.htm and vice versa.

Clicking on the links, the reader will shift from one document to the other.
<HTML>
<HEAD><TITLE>Page 1</TITLE></HEAD>
<BODY>
<P>
This is the <A HREF="two.htm">link to page two</A>.
</P>
</BODY>
<HTML>

<HTML>
<HEAD><TITLE>Page 2</TITLE></HEAD>
<BODY>
<P>
This is the <A HREF="one.htm">link to page one</A>.
</P>
</BODY>
<HTML>
Try this:
  1. Open Notepad

  2. copy the code of "one.htm" and save it as one.htm

  3. copy the code of "two.htm" and save it as two.htm in the same folder

  4. open "one.htm" with your browser and verify how the links work.

Link to download or view a file

We can put a link to any kind of file to let you view or download it.
Specify the file name and, if needs, his path:
<A HREF="files/docs.zip">Download the documentation (ZIP)</A>

Go to a point of a page

We can put a link to any point in the same page or in another.

We need to give a name to the target point and write a tag in the start point and a tag in the target point.
<A HREF="#endpoint">Go to the end point!</A>

<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>

<A name="endpoint">This is the end point..</A>

Go to an element of a page

We can put a link to another element (an heading, a paragraph, a list and so on) in the same page or in another.

We need to mark the element with an identificator (id), write a tag in the start point and a tag in the target point.
<A HREF="#chapter1">Go to the first chapter!</A>

<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>

<H1 id="chapter1">Chapter 1</H1>

Use an image as a link

The combination of an image and a link is useful:
Click the thumbnail to see my house:

<A HREF="house.jpg"><IMG src="littlehouse.jpg" ALT="Home thumbnail"></A>

<BR><BR>

Click the button to see a photo:

<A HREF="flower.jpg"><IMG src="button.png" ALT="button"></A>
Click the thumbnail to see my house: Home thumbnail

Click the button to see a photo: button

Link to a mail address

This kind of link has a mail address for target:
Send me a <A href="mailto:bob@mymail.com">mail</A>!
Send me a mail!


Next page :

how to use tables.



|   Back   |   Index   |   Next   |