What is a File path?
A file path describes the location of a file in a directory/folder structure, and the folder can be for a website or anything else.
Now we will see how you can define the path of files in HTML.
HTML file path example
./– If a file is in the current folder where the HTML file is located, you can specify the file name directly or you can add
./before the file name.
../– It means, go one step back from the current folder. Similarly, If you want to go two steps back, then add this two times, like –
/– It defines the root folder of a website.
Absolute File Paths VS Relative File Paths
All the above examples are examples of relative file paths. And an absolute file path is the full URL to a file.
Absolute file path example
Relative file path example
./images/mypic.png OR /images/mypic.png