Often we use some attributes such as href, link, src etc. which specify the location of other documents that need to be imported to the HTML document. Generally, these attributes define the location and file path of the other document. If the other document resides in the same location where the HTML document is, then we just specify the document name else we specify path location from the HTML document.
|<img src ="image.jpg">
|image.jpg is at same folder where the HTML file is present.
|<img src ="images/image.jpg">
|image.jpg is present in the images folder where the current HTML file present.
|<img src="C:\Users\xyz\Pictures\Saved Pictures\ image.jpg">
|image.jpg is located at C:\Users\xyz\Pictures\Saved Pictures location in the system.
|image.jpg is located at the server of techgeekbuzz.com images.
- Web Pages
- Style Sheet document.
Type of File Paths
There are generally two types of file paths:
- Absolute File Path
- Relative File Path
Absolute File Path
<img src="https://secureservercdn.net/220.127.116.11/84g.4be.myftpupload.com/wp-content/uploads/2019/03/Techgeekbuzz.png" alt="techgeekbuzz logo">
In the Relative path, the HTML document and external document reside in the same system or server so that a direct path can be specified.
- File path specifies the location of the external document.
- The file name should be specified along with its extension.
- If the external file present in the same folder where the HTML document is then we only need to specify the file name and its extension.
- In an absolute file path, we specify the file URL present at another server.
- In the relative path, the external and HTML document present in the same system.