Whenever we make a project it is generally distributed among various folders. That is generally done to improve the connectivity and readability for the various web developers working on the same project. For example:
The above classification is just an example but the classification can be bigger. So if you have to call an image from the image folder for the home page or want to call a page in article form the home page it would be a direct URL ie. “Images/gfg.jpg” or “Other Pages/Articles/Gfg Article1.html“. But if you have to call an image from the image folder for the Gfg Article1 page then the general URL will not work. You have to use a relative file path.
To learn more about the relative path please follow this article.
It shows the path of the file present in a folder above the folder of the current web page file. The image file present in a folder called images and current web page file exists inside a subfolder, then the code will be as follows:
It shows the path of the file present in a folder which is located at the root of the current subdirectories.
- How to make an HTML link to open a folder?
- How to move a file into a different folder on the server using PHP?
- Deleting all files from a folder using PHP
- HTML | <link> Tag
- How to see the changes in whole directory/folder containing many sass files ?
- How to copy folder recursively in Node.js ?
- Why does SASS cache folder is created ?
- How to insert a whole folder in New Google Sites ?
- What purpose does a <script> tag serve inside of a <noscript> tag?
- Difference between <article> tag and <section> tag
- Why <big> tag is not in HTML5 while <small> tag exists ?
- HTML | DOM History back() Method
- What is the difference between Front-End and Back-End Web Development?
- Best Books to Learn Back-End Web Development
- Which One is Most Demanding Back-End Web Framework between Laravel , NodeJS and Django ?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.