Up to now, you have been creating all your files in the same directory (in the Macintosh, these are called folders). At least, we hope you have, otherwise your links won't have worked!
However, it's not always convenient to save all your HTML files in the same directory or folder. You may be building a complex Web site that has many files relating to many different topics, which you would prefer to arrange as an information "tree."
You can do this, and still have any Web browser find a linked file, by writing the directory path into any link. As we have seen, if you just write the name of the file, your Web browser assumes that it is in the same directory as the HTML file the browser is displaying.
If you had created a new directory at the same level as this HTML file, and saved another HTML file into it to which you wanted to link, then a link with the proper directory path would be:
If your file is buried even deeper than one level, just keep writing the path until it points the browser to the right file:
If you create your new directory above the directory in which your HTML file is saved, you can direct the Web browser to look "up" by writing two periods before the delimiter, like this:
You can keep moving "up" by adding more period-period-slashes, right to the topmost or "root" level of a disk drive. This way, you can point to a file anywhere on the same drive as the HTML file from which you are linking, as long as you know where they are.
Back to Linking Documents with HTML
Up to the Contents page