DEV Community

Cover image for                                       Relative Path and Absolute Path
obasekisemi
obasekisemi

Posted on

Relative Path and Absolute Path

Alternatively known as the pathname, the current path or path is the complete location or name of where a computer, file, device, or web page is located.
An absolute path is a path that describes the location of a file or folder regardless of the current working directory; in fact, it is relative to the root directory. It contains the complete location of a file or directory.
Absolute paths contain all the relevant information to find the resources indicated by an absolute URL. An absolute path must be used to refer to websites that are on a domain other than your home domain.
A relative path is a path that describes the location of a file or folder in relative to the current working directory. It can be best used to refer to websites that are located on the same domain, ideally on certain sections of websites in which the documents never change relationships to each other.
Unlike absolute paths, relative paths contain information that is only relative to the current document within the same website which avoids the need to provide a full absolute path. In simple words, relative path refers to a path relative to the location of the current webpage.

Top comments (0)