In web development, file paths tell your web page exactly where to find other important files like images, stylesheets (CSS), or links to other pages. Without correct file paths, your website cannot display images or load styles properly. Learning how absolute and relative paths work is essential for organizing projects and avoiding broken links.
https:// when pointing to a web URL./ from the website root on a server../ for the current folder and ../ to go up one folder.File paths are used in many HTML tags like <img>, <link>, and <a>:
<!-- Image -->
<img src="images/photo.jpg" alt="My photo">
<!-- CSS file -->
<link rel="stylesheet" href="css/style.css">
<!-- Link to another page -->
<a href="pages/about.html">About Us</a>
An absolute path tells the browser exactly where to find the file on the internet or at the root of a website.
<!-- Linking to an image using an absolute URL on the web -->
<img src="https://example.com/images/photo.jpg" alt="Example Image">
Relative paths depend on where your current HTML file is saved:
./ – current folder where the HTML file is.../ – one folder up from the current folder.images/).
<!-- Image in the same folder as HTML file -->
<img src="./photo.jpg" alt="Photo in current folder">
<!-- Image inside a subfolder named "images" -->
<img src="images/photo.jpg" alt="Photo in images folder">
<!-- Image in the parent folder of current folder -->
<img src="../photo.jpg" alt="Photo in parent folder">
Below is an image loaded from an absolute URL and an example of a relative path. The relative path may not work here because the local file does not exist in this environment, but it will work correctly if your project folders are set up properly.
Example 1: Image from an absolute URL (should display if online):
Example 2: Image using a relative path (likely broken here due to missing local file):

./ to refer to files in the current folder and ../ to go up one folder level.Images/ ≠ images/).project/ → index.html, images/ → logo.png, css/ → style.css. Link both assets using correct relative paths.index.html into a subfolder (for example, pages/) and fix all broken relative paths so everything works again.Logo.png → logo.png) and see how it behaves on a case-sensitive host.
<link rel="stylesheet" href="./css/style.css">
./, ../, and folder names.