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:

  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

May be interested

  • How to display the full path in File Explorer on Windows 10How to display the full path in File Explorer on Windows 10
    in this tutorial, tipsmake.com will guide you through the steps to display the actual full path for the current location in the file explorer title bar on windows 10.
  • Basic examples of HTMLBasic examples of HTML
    in the previous html lesson, you know which tools to use to write html code, how to save and open html files. this article will give some basic examples of html text.
  • How to Make a Scrolling Marquee in HTMLHow to Make a Scrolling Marquee in HTML
    a scrolling marquee is moving text added to a website, but html is no longer commonly used for this feature and is not recommended. the html tag for scrolling marquees has been deleted from the standard html library. to accomplish a...
  • How do I show file paths on Mac?How do I show file paths on Mac?
    on macos, there are up to three methods that you can use to display specific file or folder paths.
  • eQuiz - Multiple choice test on HTML knowledgeeQuiz - Multiple choice test on HTML knowledge
    in this test, we will proceed with the small html test, there will be 30 questions in total with no response time, you must choose the answer in each question. can continue to the next sentence.
  • Paths in HTMLPaths in HTML
    you can find links (links) throughout the web. link allows clicking to switch to another page.
  • How to Convert Html to WordHow to Convert Html to Word
    this wikihow teaches you how to convert an html file into a word document. you will need to use microsoft word to perform this process; luckily, word will automatically convert an html document into its web page format when you open the...
  • How to save the entire website into an HTML fileHow to save the entire website into an HTML file
    we can save the entire web page as an html file to access it anytime using the singlefile utility installed on the browser.
  • Why write neat and organized HTML?Why write neat and organized HTML?
    you will get many benefits from writing clean and precise html code. here's why it's a good idea to write optimal html code.
  • HTML formHTML form
    the form in html contains form elements - the element types that take input data such as filling in text fields, checkboxes, buttons, submit buttons ...