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

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
218,695 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.