File path in HTML
The article explains how to refer to the file path in HTML.
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:
- Webpage
- Image
- Style Sheet
- JavaScript
anh.jpg placed in the same directory as the current page
anh.jpg placed in the image folder of the current directory
anh.jpg placed in the root image directory (root) of the current web page
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.

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.

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.

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
- Introduction to HTML
- Copying file and folder paths in File Explorer is now much simpler on Windows 11
- What is HTML? Basic HTML structure
- How to insert CSS to create styles for HTML pages
- 5 steps to learn a dynamic HTML web component profile
- Did you know Windows 10 solved the path problem longer than 260 characters? Read the article below
- The id attribute in HTML
- How to Find a File's Path on Windows
- JavaScript location in HTML File
- How to display the full path in File Explorer on Windows 10
- Basic examples of HTML
- How to Make a Scrolling Marquee in HTML
- How do I show file paths on Mac?
- eQuiz - Multiple choice test on HTML knowledge