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 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!