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 trialSusan Dubickas
828 PointsImage tag exists but error states 'Make sure you include an image tag...". How do I correct this?
How do I fix this code snipit?
<li> <a href="img/numbers-01.jpg"> <img src="img/numbers-01.jpg" alt=""> </a> </li>
Thanks!
<!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>
<ul>
<li>
<a href="img/numbers-01.jpg">
<img src="img/numbers-01.jpg" alt="">
</a>
</li>
<li>
<a href="img/numbers-02.jpg">
<img src="img/numbers-02.jpg" alt="">
</a>
</li>
<li>
<a href="img/numbers-06.jpg">
<img src="img/numbers-06.jpg" alt="">
</a>
</li>
</ul>
</section>
<footer>
<p>© 2013 Nick Pettit.</p>
</footer>
</body>
</html>
10 Answers
Riley Hilliard
Courses Plus Student 17,771 PointsThe exercise asks for you to place numbers-01.jpg
in the src
attribute. You placed img/numbers-01.jpg
. (You also don't need the anchor elements for this exercise, but it should still pass even if you have them, just be sure to correct the src
attributes of the img
elements)
Christopher Mlalazi
Front End Web Development Techdegree Graduate 17,305 PointsI think your problem is with the first link, you have used a tag for website link for an image one - change the a href to img src <img src="img/numbers-01.jpg" alt="">
Riley Hilliard
Courses Plus Student 17,771 PointsThe issue is the path in the src
of the images, not the elements themselves. Although I don't think the exercise calls for anchor elements, it should still pass with them as long as the image(s) inside the anchor elements are written as the exercise asks.
Christopher Mlalazi
Front End Web Development Techdegree Graduate 17,305 PointsI don't remember the exercise, but I just spotted that she is using img where she is supposed to use anchor a href. I have made countless posts I was trying to post code but have failed :)
Riley Hilliard
Courses Plus Student 17,771 PointsAgain, this has nothing to do with anchor vs img, it has to do with the resource path. The issue here is img/numbers-01.jpg
vs numbers-01.jpg
, not a
vs img
, or href
vs src
. The issue is the question asks to put numbers-01.jpg
in the src path, and Susan put img/numbers-01.jpg
Christopher Mlalazi
Front End Web Development Techdegree Graduate 17,305 PointsAnd Riley, are you sure if you use a href where you are supposed to use img src you will get yo your images? This is not what we have been taught here
Riley Hilliard
Courses Plus Student 17,771 PointsPlease read my answer again.
Christopher Mlalazi
Front End Web Development Techdegree Graduate 17,305 PointsAnd Riley, are you sure if you use a href where you are supposed to use img src you will get to your images? This is not what we have been taught here can you please show us a link where we can read about that.
Riley Hilliard
Courses Plus Student 17,771 PointsPlease read my answer again.
Christopher Mlalazi
Front End Web Development Techdegree Graduate 17,305 PointsI have re-done the excercise and it only works with (img src) and not (a href) so Riley why did you downvote my answer? You are not a good Moderator. Here is the correct code: ' <!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> <ul> <li> <img src="numbers-01.jpg"> </li>
<li>
<img src="numbers-02.jpg">
</li>
<li>
<img src="numbers-06.jpg">
</li>
</ul>
</section>
<footer>
<p>© 2013 Nick Pettit.</p>
</footer>
</body> </html> '
Riley Hilliard
Courses Plus Student 17,771 PointsBecause your answer above is correct because you fixed the path of the src attr of the img element, like I stated in my answer. In your answer below you said the issue was in the href, that is not the issue, the issue is the src path of the image.
It is NOT img/numbers-01.jpg
It IS numbers-01.jpg
Therefore your answer below was incorrect. Your answer above is correct, because you have the correct path in the src. This has nothing to do with the href of the anchor element.
Christopher Mlalazi
Front End Web Development Techdegree Graduate 17,305 PointsHer error emanates from using (a href) where she was supposed to use (img). I did not go on further to talk about the file path (images), so that does not make my first answer wrong. Just like you, you say that 'You also don't need the anchor elements for this exercise, but it should still pass even if you have them..’ This is very wrong you don’t pass the exercise if you use the anchor element.
Christopher Mlalazi
Front End Web Development Techdegree Graduate 17,305 PointsI have read your answer again, you are right about the path only, but not about passing the exercise when you use anchor (a href).
Riley Hilliard
Courses Plus Student 17,771 PointsIt looks like we are both partially right
Christopher Mlalazi
Front End Web Development Techdegree Graduate 17,305 PointsSo please up vote my first answer it is not wrong lol