Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

HTML How to Make a Website Creating HTML Content Structure the Image Gallery

Alex Weinberg
Alex Weinberg
2,726 Points

The image from this video is not showing up when I go to preview it.

This is what I have written down for the code following along with the video. I've saved it, and when I go to preview the page, the image shows up as a blue box with a question mark inside. Not sure where I'm going wrong. Thanks!

<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Alex Weinberg | Designer</title> </head> <body> <header> <a href="index.html"> <h1>Alex Weinberg</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>
  <ul>
    <li>
      <img src="img/numbers-01.jpg" alt="">
    </li>
  </ul>
</section>
<footer>
  <p>&copy; 2014 Alex Weinberg</p>
</footer>

</body>

</html>

2 Answers

Matt Campbell
Matt Campbell
9,767 Points

In HTML5, img is forbidden to be closed. Reference: http://blog.teamtreehouse.com/to-close-or-not-to-close-tags-in-html5

As for the image not showing up, the file is in the right directory with the right name etc? Check the obvious first.

Well, well! You learn something new everyday! Did not know that! Thank you :) Looks like img and couple of other elements are void elements and are not supposed to have closing tags.

Alex Weinberg
Alex Weinberg
2,726 Points

Thanks for the tips guys. It was a very obvious mistake on my part, a the name of the directory did not match. Sorry, I'm very new at this and it's a bit overwhelming. Thanks again!