freecourses.digital
Lesson progress: 0 of 3 activities done
All lessons in HTML Basics for Beginners Lesson 5.2 of 34

Module 10: Practice Project and Validation

  1. 10.1Build a simple HTML website

Image paths and file locations

This lesson covers

  • Organizing an images folder
  • Relative and absolute src paths
  • Naming image files
  • Troubleshooting broken images

Short answer

The src of an image follows the same rules as link URLs. A relative path like images/logo.png starts from the current HTML file. A root-relative path like /images/logo.png starts from the site root. Most broken images come from a wrong folder, a typo, or uppercase letters that do not match.

Organize your images

my-site/
  index.html
  about/
    index.html
  images/
    logo.svg
    team/
      ana-reyes.webp

Keep images in one images folder, with subfolders for groups. It makes paths predictable.

Writing src paths

HTML fileImagesrc
index.htmlimages/logo.svgimages/logo.svg
about/index.htmlimages/logo.svg../images/logo.svg
Any pageimages/logo.svg/images/logo.svg
Any page, image on a CDNhttps://cdn.example.com/logo.svg

Name image files well

  • Lowercase letters only.
  • Hyphens between words, no spaces.
  • Describe the image: pili-tarts-box.jpg, not IMG_20260315_0912.jpg.
  • Keep the extension correct: .jpg, .png, .webp, .svg.

Descriptive file names help you find files, and Google Images uses them as a small hint about the image.

Troubleshooting a broken image

  1. Right click the broken icon and choose Open image in new tab. Read the URL the browser tried.
  2. Check the folder exists and the file is there.
  3. Compare spelling and capital letters: Logo.PNG is not logo.png on most servers.
  4. Check the extension. A file saved as .jpeg will not load from .jpg.
  5. Open DevTools (F12), go to the Network tab, and look for red 404 errors.

Try it: spot the broken path

Three images are broken because of path or name mistakes. Read each src and fix it. Hint: compare with the file names listed in the comment.

Live preview

Quick quiz

1. From about/index.html, which src reaches images/logo.svg?
2. Which file name is best?
3. Logo.PNG vs logo.png on a Linux server?
4. Which DevTools tab shows 404 image errors?

Common mistakes

  • Linking to files on your computer. src=“C:\Users\…” only works on your own laptop.
  • Hotlinking other sites’ images. Their image may vanish, and it uses their bandwidth.
  • Camera file names. IMG_1234 says nothing about the image.

Your action

Tick each item when you can do it. Your progress saves on this device.

Key terms

Image path
The location written in an img src.
Hotlinking
Embedding an image hosted on someone else's site.
404 error
The server message when a file is not found.
DevTools
Browser tools for inspecting pages, opened with F12.
CDN
Content Delivery Network that serves files from servers near the visitor.

Questions beginners ask

Why does my image work locally but not online?

Usually letter case or a missing upload. Check both.

Should I use absolute paths for images?

Root-relative paths are fine on your own site. Use absolute URLs for images on another domain or CDN.

Can I put images in the same folder as HTML?

Yes, but a separate folder keeps bigger sites tidy.

Related lessons

Need a website built or fixed while you practice? The team at Remar Digital can help.