2.15
External links
A text hyperlink is a section of text that is specially
tagged as a link. Links are what makes the Web because thay connect
pages to other files across the Internet. To create a link you use the
<a>, or anchor tag with the href attribute that specifies the
location of the linked page or other file.
<a href="filename.html">Click here!</a>
2.23 Absolute path names
Use absolute links to link to pages located on other servers.
In an absolute link, you specify the fully qualified URL in the link.
While you can use an absolute link within your own site, it is not recommended
because it places an additional unecessary burden on the server, which
must resolve the domain name before it can retrieve the page.
<a href="http://www.wccnet.org">WCC</a>
appears on the page as:
WCC
Create
a Linked Web Page
Create an HTML document
Create a link to MCCC's server
http://www.monroeccc.edu/
Save the file
Test the link in the browser
2.24 Relative Paths
Relative links can only be used to link
to files located on the same server as the page containing the link.
You must be careful to specify the correct directory level. Use the
double dot (..) to indicate moving up one level in the directory structure.
Common Directory Structure
folder01
folder01a
folder01b
folder01c
folder02
folder03
folder03a
folder03b
folder03b_1
folder03b_2
|
For example,
assume all the folders contain an index.html page:
- A link from folder01 to folder03:
<a href="../folder03/">Folder 3</a>
- A link from folder03b to folder01:
<a href="../../folder01/">Folder 1</a>
- A link from folder01c to folder03b_2:
<a href="../../folder03/folder03b/folder03b_2/">Folder
3</a>
- A link from folder01c to folder01b:
<a href="../folder01b/">Folder 3</a>
|
Trailing
slashes
While you do not have to include the trailing
forward slash, it relieves the server of some work because the slash
tells the browser to look for a default page. Without the slash, the
browser first looks for a file named the same as the last folder specified
and when it doesn't find one, looks for a default page. Although the
above assumes a link to the default page contained within each folder,
if you want to link to a page with a different name, simply specify
the file name in the link following the trailing forward slash.