A file path describes the location of a file in a web site's folder structure.
File Path Examples
The "picture.jpg" file is located in the same folder as the current page | |
The "picture.jpg" file is located in the images folder in the current folder | |
The "picture.jpg" file is located in the images folder at the root of the current web | |
The "picture.jpg" file is located in the folder one level up from the current folder |
HTML File Paths
A file path describes the location of a file in a web site's folder structure.
File paths are used when linking to external files, like:
- Web pages
- Images
- Style sheets
- JavaScripts
Absolute File Paths
An absolute file path is the full URL to a file:
Example
Try it Yourself »
The
Relative File Path: It describes the path of
the file relative to the location of the current web page file.
Example 1: It shows the path of the file present in the same folder of the current web page file.
html
Relative file path
File present in the same folder
Output:
Example 2: It shows the path of the file present in a folder above the folder of the current web page file. The image file
present in a folder called images and current web page file exists inside a sub folder, then the code will be as follows:
html
Relative file path
File present in a folder above the current folder
Output:
Example 3: It shows the path of the file present in a folder which is located at the root of the current sub directories.
html
Relative file path
File present in a folder which is located at
the root of the current subdirectories
Output:
Supported Browser:
- Google Chrome
- Microsoft Edge
- Firefox
- Opera
- Safari
CSS is the foundation of webpages, is used for webpage development by styling websites and web apps.You can learn CSS from the ground up by following this CSS Tutorial and CSS Examples.