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

Linking photos

hello, can't get my images to have the link for some reason. rewrote it a couple times.

4 Answers


Can you post your code so we can see.

Errol Ikalina
Errol Ikalina
353 Points

normally it would be something like this... if the filename of the image is photo.jpg and in the folder called img and it's within a list element.

<li><a href="img/photo.jpg"><img src="img/photo.jpg"></a></li>

Hope this helps.

I can't see anything wrong with the syntax of your code. Here is mine, which is exactly the same as yours - folder name different.

 <ul id="gallery">
            <a href="Images/numbers-01.jpg">
              <img src="Images/numbers-01.jpg" alt="">
                <p> Something></p>

If it's still not working, then add a new html page, copy and paste the basics, doctype, head and body, and then try add the same code to see if it works there.

Make sure the image name is exactly the same, watch out for caps, provided the photo is in your dictionary as well!

Errol Ikalina
Errol Ikalina
353 Points

Hi Nitish, I think you're confusing my reply as Michael's, my reply was to show michael how it should look like. Although you pointed out in your own code something I missed with mine which is the alt="" part after the link to the image.

My bad! No wonder I did not see the problem in the code...