A file path in html defines the area of a file inside the web folder. File paths are applies to interface outside sources such as images , video, style sheets, JavaScript, and different web pages.

Home Page - Basic Engineer
Home Page – Basic Engineer

File path are two types

  • Absolute file path
  • Relative file path

Absolute file

  • A path is an absolute path if the entire URL and file name can be paste into a browser’s address field to locate a specific page on the Internet.
  • An absolute path specifies a fully-qualified URL; the protocol (http://) must be present in addition to the site’s domain name, and often a subfolder or specific file name is include as well.
  • This is an example of link to an absolute URL :
    • <a href=”http://www.google.com/”>Google search engine</a>
  • The URL in the link above can be load regardless of the current page display in a browser.
<html>
<body>
<h1>Absolute file</h1>
<p>
<img src="https://static3.makeuseofimages.com/wordpress/wp-content/uploads/2017/09/HTML-Effects-Featured.jpg" width="500" height="500">
</p>
</body>
</html>

Relative File

A relative path specifies the name of the file to be link to only as it is related to the current document.

For example

For example, if all the files in our Web site are contain within the same directory (or folder), and we want to establish a link from page1.html to page2.html, the code on page1.html will look like this:

<a href = “page2.html”>Go to pages 2 </a>

This link will be valid only from within the same directory that page2.html is saved in. The browser receives the request for the new page, looks in the current directory (folder) of the current page, and finds a file named page2.html to display.

<html>
<body>
<h1>Relative File</h1>
<p>
<img src="C:\Users\Dell\Desktop\New folder\4444.jpg" width="500" height="500">
</p>
</body>
</html>
example of Relative file

If you have any queries regarding this article or if I have missed something on this topic, please feel free to add in the comment down below for the audience. See you guys in another article.

To know more about HTML file path please check Wikipedia link Click here

Stay Connected Stay Safe. Thank you 🙂


Basic Engineer

Hey Readers! We have more than fifteen years of experience in Software Development, IoT, Telecom, Banking, Finance and Embedded domain. Currently we are actively working on Data Science, ML and AI with multiple market leaders worldwide. Happy Reading. Cheers!

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *