HTML file path tutorial

How to define the file paths in HTML?

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.
How to define file path in HTML

HTML path current folder example
HTML path Current folder Example

HTML file path inside a folder example
Image Inside a folder example

go one step back folder example
HTML file path – go one step back folder example

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