The absolute path spells out exactly where the file is located on the computer. For example, if you needed to access file ABC.html which is located in subfolder Pages which is located in folder Home, on the A: drive, the absolute pathname would look like this:
/A|/Home/Pages/ABC.htmlNotice that the path name begins with a slash (/) and there is a slash separating the drives, folders, subfolders, and file name. Also, if you access a file on a different drive, you need to include a pipe ( | ) after the drive letter. One of the problems with using this format is that path names can become very long and cumbersome and can be very confusing.
A relative path will be the file's location in relation to the current Web document. In the above example, the web page ABC.html is located on the (A:) drive in the subfolder (Pages) which is located in the folder (Home). If the ABC.html code referenced a file located in the (Pages) subfolder, it would only need to reference the file name. If a relative path is used, the browser will use the folder where the HTML file is located. For example, if ABC.html code references the image school.jpg, the absolute path name would be (/A|/Home/Pages/school.jpg). For a relative path, the HTML code would only need to refer to the file name of school.jpg. If the file is in a folder above the current folder in the hierarchy, you would use two periods (..) to jump back to the previous folder. For example, if the image file school.jpg were located in the (Home) folder, the HTML code would look like this (../school.jpg). You may also have noticed that a slash is not needed at the very beginning of the path like in the case of and absolute pathname. Relative paths tend to be less confusing and much easier to code.
Absolute PathnamesThanks for Visiting My Linking types Comparison Page!