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

Adding image tags

Hi I am having a problem with image tags in a ul: Here is what I wrote

        <img src="img/numbers-001.jpg" alt="">

I keep gettting an error message

5 Answers

Every "un-ordered list" (ul) needs list-items (li) within it, or else it will be an empty list.

Actually, when determining the file source of an image, it's best to include very specific paths. As an img src="" or a href="". The difference between the two, is that the "img src" is the actual display of the image itself while, "a href" is used to wrap the image in, and anchors the image to an external area for utilization.

For example, your code should look like this...

        <ul>
          <li> <a href="img/beach.jpg" alt=""><img src="img/beach.jpg"></a>
          </li>
          <li><a href="img/lake.jpg" alt=""><img src="img/lake.jpg"></a>
          </li>
        </ul>

Lastly, it's best to use images that you do not have to externally link from the web. (ex: http://2.bp.blogspot.com/-GINzHqJnaUY/UFBBfdBpB_I/AAAAAAAACEA/7juKHHvuMPk/s1600/stock%2Bphotos%2Bfree.jpg) They are much longer, and less reliable for future use.

Thank you very much Alissa! This is so helpful!

Hi Lisa!

Umm.., I'm a novice myself, but I'll try to help you out as much as I can. In this particular challenge I think the images are in the html-root, and does not need to be called upon from a file. I was able to complete this challenge with the code underneath, maybe you can try it out?

Just a note, as I said I'm a novice myself, and hopefully some of the other great people here can explain the logic behind this particular code much better then I am able to. Good luck!

Edit: I noticed you also had one 0 too many, deleting one should help :)

        <li><img src="numbers-01.jpg"></li>

      </ul> ```
Dario Tordoni
Dario Tordoni
9,635 Points

Jakub is in right, images are in html-root. Also there is a "0" more the file name you wrote.

I am also having trouble with it. I wrote it exactly like Lisa minus the extra 0. The directions say "Inside the three new list items, add the following images: "number-01.jpg", "number-02.jpg", "number-06.jpg". Leave the alt attributes blank, and don't add any captions or links. Just the images!" I'm just not understanding what is wrong... help!

Hi Ashley!

In this particular challenge I think the images are located in the root-html, and not in a image file. Try this and see if it helps:

*Edit

''' <nav> <ul> <li><img src="number-01.jpg"></li> <li><img src="number-02.jpg"></li> <li><img src="number-06.jpg"></li>

</ul>

Thank you so much everyone for your answers! I apologize for taking so long to reply, I had a family emergency and have been offline for the past week.