Section 1 - Introduction
Section 2 - Basics
Your first page
Formatting
Text tricks
Pictures
Links
Anchors
External Links
In-site Links
Navigation Links
Pictures
E-mail
Targets
You try it
Backgrounds
Section 3 - Next Level
Section 4 - Advanced
Section 5 - Publishing
Section 6 - Extras
Appendices
|
Same site, different document
Thankfully, computer geeks are inherently lazy. They make shortcuts whenever they can. When you are linking to a different page in the same file, there is a shortcut you can use. Rather than typing the whole http address, you can use what is known as a relative address. When doing this, all you need is the name of the page. Let me show you how that works.
- Long way - <a href="http://html.pageofmystery.com/demolink.html"> Link </a>
- Short way - <a href="demolink.html"> Link </a>
This way only works for html pages that are in the SAME file. If the file is in another location or on someone else's website, you're stuck using the long way. By the way, here's how those links look.
Code |
---|
Long way - <a href="http://html.pageofmystery.com/demolink.html"> Link </a>
<br><br>
Short way - <a href="demolink.html"> Link </a>
|
|
What you see |
Long way - Link
Short way - Link
|
|
If you click on those, you'll find that they lead you to exactly the same location. That location is located on this website and in the same folder as this page you're reading. It's nice to use shortcuts when you have a lot of links to make.
|