The article explains how to refer to the file path in HTML.

File path in HTML

The file path is the file's address in the directory structure of the website, which can be used when linking to external files such as:

  1. Webpage
  2. Image
  3. Style Sheet
  4. JavaScript
Path Description File path in HTML Picture 1 anh.jpg placed in the same directory as the current page File path in HTML Picture 2 anh.jpg placed in the image folder of the current directory File path in HTML Picture 3 anh.jpg placed in the root image directory (root) of the current web page File path in HTML Picture 4 anh.jpg is placed in a folder on the current directory one level

Absolute file path

Absolute path is the full URL of the Internet file.

 Sky 

Relative file path

The relative path points to a file related to the current page. In this example, the path points to the file in the last image folder of the current web page.

 Sky 

In this example, the path points to the file in the image folder placed in a folder on a level compared to the current directory.

 Sky 

Usually, use relative links (if possible) because the site will not be tied to a certain URL. All links are available on your computer (localhost) and on the public domain as well as in the future.

Previous article: JavaScript in HTML

The following article: Head element in HTML

4 ★ | 1 Vote | 👨 202 Views

Above is an article about: "File path in HTML". Hope this article is useful to you. Don't forget to rate the article, like and share this article with your friends and relatives. Good luck!

« PREV POST
NEXT POST »