HTML Java

HTML File Paths


HTML File Paths

Path Description
<img src="photo.jpg"> photo.jpg is located in the same folder as the current page
<img src="images/photo.jpg"> photo.jpg is located in the images folder in the current folder
<img src="/images/photo.jpg"> photo.jpg is located in the images folder at the root of the current web
<img src="../photo.jpg"> photo.jpg is located in the folder one level up from the current folder


HTML File Paths

A file path describes the location of a file in a web site's folder structure.

When linking to external files, file paths are used:

  • Web pages
  • Images
  • Style sheets
  • JavaScripts

Absolute File Paths

An absolute file path defines the full URL address to an internet file.

Example

<html>
<body>
  <h2>Using a Full URL File Path</h2>
  <img src="image/tortoise.jpg" alt="Tortoise" style="width:400px">
</body>
</html>
Try it »


Relative File Paths

A relative file path points to a file relative to the current page.

Example

<html>
<body>
  <h2>Using a Relative File Path</h2>
  <img src="image/jaipur.jpg" alt="Jaipur" style="width:400px">
</body>
</html>
Try it »