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 Add Image Gallery Content

Mike Carter
Mike Carter
1,689 Points

when i click on my img's the link takes me to a 404 message...what am I missing? i can't spot diff in code?

I can't seem to find any differences in my code form Nick's, but whenever I click on my img in the preview, it links me to a 404 message.

Candice Eisner
Candice Eisner
10,514 Points

Can you include your code? :)

2 Answers

Isaac Asante
Isaac Asante
4,752 Points

Hey Mike, your code should be like this. Make sure your images are well into the /img folder. Also, debug your code for missing closing tags, quotation marks, etc...

        <ul id="gallery">
          <li>
            <a href="img/numbers-01.jpg">
              <img src="img/numbers-01.jpg" alt="">
              <p>Caption description.</p>
            </a>
          </li>
          <li>
            <a href="img/numbers-02.jpg">
              <img src="img/numbers-02.jpg" alt="">
              <p>Caption description.</p>
            </a>
          </li>
          <li>
            <a href="img/numbers-06.jpg">
              <img src="img/numbers-06.jpg" alt="">
              <p>Caption description.</p>
            </a>
          </li>
Mike Carter
Mike Carter
1,689 Points

I didn't have the <ul id="gallery"> written out, for some reason I only had <ul>

Justin Horner
STAFF
Justin Horner
Treehouse Guest Teacher

Hello MIke,

Without seeing your code I don't know if the problem is with the code or not but if your code is truly identical to the video, I would guess that the problem is where the linked file is on disk in relation to your source.

Make sure that your href element contains the correct name and location of the file you're trying to link to. Something as simple as a typo on the file name or not including a directory in the href will cause a 404 because it can't find the linked file.

I hope this helps.

Mike Carter
Mike Carter
1,689 Points

whats the best way for me to include my code? i couldn't figure out how to add a picture