If you're specifying the path of an image, you can use either an absolute path or a relative path. The same thing applies if you're creating a link to another web page document.
An absolute path means that the entire path is specified. Examples would be:
http://www.computer-answers.info/Images/Image_1.jpg http://www.computer-answers.info/index.php
The advantage of using absolute paths is that there's no ambiguity, and therefore less room for error.
Rather than specifying the entire path to the destination, a relative path only specifies the location relative to the current document. There are 4 different forms that this can take:
An advantage of relative paths is obviously that they're shorter. Another advantage is that if you maintain the same directory structure on your own computer as on your website, then you can view your pages offline and the links will still work.
Note that this doesn't apply to links of the form /directory/filename, since they're relative to the root directory of the website. If you're viewing a web page offline, then this will be interpreted as the root directory of your computer, which won't be correct unless you've replicated your website's directory structure in your computer's root directory.
The advantage of relative paths is that there's no ambiguity - you can see the full path so you know exactly where the target file is located.
Whether you choose to use absolute or relative paths is larely a matter of personal preference.
<-- Previous Page Image Width and Height |
Next Page --> Links and Anchors |