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 HTML Basics Images, Text and Links Images and File Paths Challenge

I answered the first question wit, " <img src="../img/moon.jpg>" and it counts as wrong? Where did I make a mistake?

The question: Inside the <body>, display the image "moon.jpg" that came from the "img." folder and I provided the answer of <img src="../img/moon.jpg" and it marked it wrong and a supervisor could not tell what I did wrong so what did I do?

index.html
<!DOCTYPE html> 
<html>
  <head>
    <title>The Moon</title>
  </head>
  <body>
    <img src="../img/moon.jpg">
  </body>
</html>
Loris Guerra
Loris Guerra
17,536 Points

You are correct here. The real solution should be the path to the file, meaning that one of the following should be correct. <img src="../img/moon.jpg"> <img src="./img/moon.jpg">

Probably for this exercise they just simplified the answer :)

1 Answer

In the case for this question the ../ isn't required but usually it would be i'm guessing this is just a simplified question to display how the folder and image name are placed. ../ means you move out of the folder you are already in so for this question they are assuming you don't have to do that.

<!DOCTYPE html> 
<html>
  <head>
    <title>The Moon</title>
  </head>
  <body>
    <img src="img/moon.jpg">
  </body>
</html>

Moderator Edit: Moved response from Comment section to Answers