If you link to pages within your own website, you can use
Relative links which look like this:
<a href="text.html"></a> . Notice how it doesn't have "http://www." at the
beginning? That tells the browser that you're staying in the
current domain.
If you want to link to a page in a different directory, say
"coolpages", you'd add the directory name to the
address, like this: <a href="coolpages/superpage.html"></a>
Let's say you're at "coolpages/superpage.html"
and you want to link back to a file in your root directory.
You'd use 2 periods and a slash ../ to get
out of the current directory, like this:
<a href="../text.shtml"></a> That moves us out of the "coolpages" directory into
the next one up (in this case, back to the root).
Are you 2 directories in? Just use ../
twice: <a href="../../text.shtml">.
You get the idea.
One last thing about relative links, you can have your link
relative to the root, so you don't have to deal with these
../ at all. Just put a single slash before
the filename, like this:
<a href="/text.shtml"></a>
and that means that no matter what directory you're in, you'll
be linking to a file in the root directory.
So remember: without the slash, you're linking
to a file in the current directory, with the slash, you're
linking to a file in the the root directory, and ../ (2 periods
and a slash) will take you out of the current directory to
the next one up.
Anchor links are cool little dittys that
take you to a specific place on a page, very often to the
top. Let's make one now: <a href="#top">Top</a>
which comes out to be this: Top
We don't have to define "top"
as going to the top of the page because that particular anchor
is already standardized to do that, but let's say we want
to add an anchor to the bottom of this page and we'll call
it bigbottom. We'd make an anchor like this:
<name="bigbottom">Ya Found Me!</a>,
and put it way down at the bottom of our page.
Then, to make a link to that anchor, we'll
put this: <a href="#bigbottom">Big
Bottom </a> right here: Big
Bottom (click it and see where it takes you).