HTML file path specifies the location of the file inside a website folder.
The file path is like an address of a file for a web browser and it helps the web browser to access the files.
Using HTML file path we can link any external resources such as images, files, CSS files, videos, etc.
Different types to specify HTML file paths:
File path are used to link external files on webpages like:
Types of HTML File Paths:
Absolute File Paths:
An absolute file path is a full address(URL) to access an internet file.
It refers to the complete path needed to locate a file or folder, starting from the root element and ending with other subfolders.
Relative File Paths:
The relative file path specifies the path of the file relative to the location of the current web page.
In the below example, the file path points to a file in the images folder located at the root of the current web.
This is how a file path points to a file in the images folder located in the current folder.
In this example, the file path points to the images folder located in the folder one level above the current folder.
Note: Don’t forget to use proper URL, file name, image name, else it will not display on the webpage. It is best to use relative file paths so that your code will be independent of the URL.