Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML How to Make a Website Creating HTML Content Organize with Unordered Lists

Tiffany Lin
Tiffany Lin
1,086 Points

Why do you have to put "img/" in front of the file names when inserting images? i.e. <img src="img/numbers=01.jpg">

I was notified that I left out the "img/" part of the code but that wasn't mentioned in the video or true for other parts of the code.

index.html
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Nick Pettit</title>
  </head>
  <body>
    <header>
      <a href="index.html">
        <h1>Nick Pettit</h1>
        <h2>Designer</h2>
      </a>
      <nav>
        <ul>
          <li><a href="index.html">Portfolio</a></li>
          <li><a href="about.html">About</a></li>
          <li><a href="contact.html">Contact</a></li>
        </ul>
      </nav>
    </header>
    <section>
    </section>
    <footer>
      <p>&copy; 2013 Nick Pettit.</p>
    </footer>
  </body>
</html>
Victor Learned
Victor Learned
6,976 Points

You must add "img/" so it creates a valid relative path. This enables the web browser to correctly find the required files when it attempts to load the images. If you didn't add it the pictures would need to be in the same directory as the html page that is attempting to load them or they wouldn't load.

Tiffany Lin
Tiffany Lin
1,086 Points

Thank you Victor Learned - that makes sense!

Kevin Chau
Kevin Chau
5,874 Points

Victor is correct. However, to add on to his explanation and to put it in simple terms. Its like using a dictionary. To find what "computer" means, you'd go to the "C" section of the dictionary first.

The "img/" tells your computer what folder(path) the image is in.

2 Answers

Kevin Mulhern
Kevin Mulhern
20,374 Points

The "img/" refers to a folder that is in your project folder. for example in a basic website you would have a folder for images and a folder for css files etc.

Because that is specifying what folder the file will come from. =)

did I give the best answer?

=D