HTML - File Paths

Overview

Estimated time: 15–25 minutes

File paths determine how the browser resolves URLs for images, links, scripts, and iframes.

Examples

<!-- Relative to current document -->
<img src="images/cat.jpg" alt="Cat">

<!-- Root-relative (from domain root) -->
<link rel="icon" href='/favicon.ico'>

<!-- Parent directory -->
<a href="../index.html">Back</a>

Common Pitfalls

  • Mixing relative bases unintentionally when using <base>.
  • Broken paths after moving files—prefer predictable structure.