Tell us what’s happening:
I’m a beginner, and just trying to understand some logic here. In this tutorial the correct response to linking an image is to use href="#"< img…etc.
In the previous lesson however, it says to use href="#" when you don’t know where your link will lead to. Why do we use href="#" before img src when turning an image into a link?
**Your code so far**
<p>Click here to view more <a href="#">cat photos</a>.</p>
<a href="#"><img src="https://cdn.freecodecamp.org/curriculum/cat-photo-app/relaxing-cat.jpg" alt="A cute orange cat lying on its back."></a>
<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
<p>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
**Your browser information:**
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36
You need to think of it as if the whole anchor element with href="#" is wrapped around the image. The exercise tells you to make the image clickable by providing a link so that when you click on the image, you’re led to the given href.
It won’t work if you don’t wrap the anchor element with the link around the image.
<img src="https://cdn.freecodecamp.org/curriculum/cat-photo-app/relaxing-cat.jpg" alt="A cute orange cat lying on its back."><a href="#"></a>
You’ll see that the anchor element doesn’t do anything. It’s not wrapped around content whatsoever so there’s nothing to click on.