HTML and CSS Reference
In-Depth Information
example, include directions to go up two directory levels and then go down two other
directories to get to the file.
To specify relative pathnames in links, you must use UNIX-style paths regardless of the
system you actually have. You therefore separate directory or folder names with forward
slashes ( / ), and you use two dots to refer generically to the directory above the current
one ( .. ).
Table 6.1 shows some examples of relative pathnames and where they lead.
TABLE 6.1 Relative Pathnames
Pathname Means
href=”file.html” file.html is located in the current directory.
href=”files/file.html” file.html is located in the directory called
files, and the files directory is located in
the current directory.
href=”files/morefiles/file.html” file.html is located in the morefiles
directory, which is located in the files
directory, which is located in the current
directory.
file.html is located in the directory one
level up from the current directory (the parent
directory).
href=”../file.html”
file.html is located two directory levels up,
in the directory files .
href=”../../files/file.html”
If you're linking files on a personal computer (Macintosh or PC), and you want to link to
a file on a different disk, use the name or letter of the disk as just another directory name
in the relative path.
Absolute Pathnames
You can also specify the link to another page on your local system by using an absolute
pathname.
Absolute pathnames point to files based on their absolute locations on the file system.
Whereas relative pathnames point to the page to which you want to link by describing its
location relative to the current page, absolute pathnames point to the page by starting at
the top level of your directory hierarchy and working downward through all the interven-
ing directories to reach the file.
Absolute pathnames always begin with a slash, which is the way they're differentiated
from relative pathnames. Following the slash are all directories in the path from the top
level to the file you are linking.
 
 
Search WWH ::




Custom Search