HTML File Paths
HTML File Paths
Dark mode
Dark code
HTML CSS
A file path describes the location of a file in a web site's folder structure.
Web pages
Images
Style sheets
JavaScripts
Example
<img src="https://www.w3schools.com/images/picture.jpg" alt="Mountain">
Try it Yourself »
ADVERTISEMENT
In the following example, the file path points to a file in the images folder located at
the root of the current web:
Example
In the following example, the file path points to a file in the images folder located in
the current folder:
Example
Try it Yourself »
In the following example, the file path points to a file in the images folder located in
the folder one level up from the current folder:
Example
<img src="../images/picture.jpg" alt="Mountain">
Try it Yourself »
Best Practice
It is best practice to use relative file paths (if possible).
When using relative file paths, your web pages will not be bound to your current base
URL. All links will work on your own computer (localhost) as well as on your current
public domain and your future public domains.
❮ Previous Next ❯
ADVERTISEMENT