Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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