File path in HTML

File path is used to locate the path where it is is stored. File paths are used on web-pages to link external files like:Web pages,Images,Style sheets JavaScript.

Types of file path

  1. Absolute file path.


  2. Relative file path.

Absolute path

Absolute path is used to describe the full path of the file where it is located. Absolute URLs is used to provide the full URL for the document, including the protocol (http://), the domain name, and the path-name as necessary.You need to use an absolute URL when pointing to a document out on the Web (i.e., not on your own server).
Example: href="https://www.webtags.com.pk/"

An example of absolute path is given below.


<img src="http://www.webtags.com.pk/img/bg-img/bg-1.jpg" alt="bg-img"/ >

bg-img

Relative path

Relative path is used to describe the path of the file which is present in the current directory. Relative URLs is used describe the path-name to a file relative to the current document. Relative URLs can be used when you are linking to another document on your own site (i.e., on the same server). It doesn’t require the protocol or domain name—just the pathname.
Example: href="xyz/index.html"

An example of absolute path is given below.


<img src="img/bg-img/bg-1.jpg" alt="bg-img"/ >

bg-img







The Best

Comment here

If you have any query, if you want to know something about any of technical course related to computer science field, if you have any suggestion about relevant to uploaded content or if you anything wrong here (any mistake in content) than please contact us. Keep in mind, comment should be according to community guidelines.