Learn HTML by Building a Cat Photo App - Step 14

Sorry, I understand my reply is a bit messy. I’ll try to go in-depth without making it confusing.

First off, an img element is a self-closing element, so you have only one tag.

<img src="" alt=""/>

You cannot place an element inside of another element’s opening or closing tags. In this case, you can’t place your <a></a> element inside of your img element’s tag, because it is unrecognizable that way.

You can only put attributes inside of element’s tags, and only on their opening tags.

For example:

<img src="" alt=""/>

src and alt are attributes, so it is correct to put them inside your img element’s tag.

In order to complete this step, you must turn your img element into a link. To do this, you must follow the same process you followed when you turned your ‘cat photos’ text into a link.

Grab your existing element, and embed it inside an anchor element.

<a><img src="" alt=""/></a>

In order to give an anchor element an address to direct to, you must give it an href attribute, and set it to the desired address.

<a href=""><img src="" alt=""/></a>

I hope this helps.

1 Like