Lesson 5: Links

When you click a link in a web browser, you are taken to another page. It might look complicated, but really it’s very simple.

Links to things

<a href="http://google.com/">Here is a link to Google</a>
a
anchor - a link, a bookmark
href
The URL of the thing you want to link to

Everything between the <a> and </a> tags becomes the link. This could be text, or it could be a picture. It can include other tags too.

You can link to other web pages, pictures, movies, or anything else on the internet. You can even link to email addresses, ftp sites, etc.

For links on your own website, there’s no need to include the “http://www.mysite.com/” part of the URL. Any absolute or relative path (remember the previous lesson?) will work.

Bookmarks on a page

<a name="Bookmark1"></a>

This defines a bookmark on your page. You can use this to jump down to a particular place on a long page, like this:

<a href="#Bookmark1">Bookmark 1</a>

If you want to get to the bookmark from another page, you use a link like this:

<a href="SomePage.html#Bookmark1">Bookmark 1 on some page</a>

Practice

Previous Lesson Index Next Lesson