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

pat barosy
pat barosy
6,759 Points

Why are we using the <a href> in the images gallery when we already have an image tag present?

I know that the <img> tag will allow us to see the image directly once the page is loaded. I don't understand why we are also using an <a href> & why we are wrapping it around the <img> and <p> tags.

Thank you

1 Answer

Steven Parker
Steven Parker
231,248 Points

By enclosing both the image and the description paragraph in the link, clicking on either one will activate the link.

And the value of the link itself is to allow you to switch from a page with a collection of thumbnail images to a full page with a single image.