absolute:
absolute file path is used when navigating to or referreing to a document ouside the website.this is the best use-case for absolute paths.not specifiying the HTTP
syntax in the path is a recommendation:
document relative:
relative paths is a way to go if it is not the use-case above.two general rules that hold all the secret for navigating effectively inside a website:
- navigating one folder deep in the file heirachy or directory-going on step deeper in the files map:
the syntax:
/folder-name
/image/icons/ios-icons/apple.ico
will go through folders: images,icons,ios-icons inorder to refere to the fileapple.ico
. -
navigating one folder up in the file heirachy or directory-going one step to the top(closer to the root folder) in the files map:
the syntax: ../ means a navigation of one folder up to the top.now we have two options depending on the files map:
- if one step to the top gets the navigation to the designated file then file name would be chossed as follows:
../file-name.jpg
- if the file is not found yet in the current directory folder.one more step to the top is implemented as follows:
../../file-name.jpg
- if one step to the top gets the navigation to the designated file then file name would be chossed as follows: