How to format an img with the alt element warped around it?


#1

<a><img src="https://s3.amazonaws.com/codecademy-content/courses/web-101/web101-image_brownbear.jpg"target= "_blank" alt="A brown bear "/></a> 
<!-- This code pops up an error that the special characters have to be escaped-->
<!-- This code doesn't seem to make the img a link-->
<a href = "https://en.wikipedia.org/wiki/Brown_bear" target = "_blank" >Learn more </a>

Should I format the code like a page link?


#2

How to format an img with the alt element warped around it?

Did you mean the <a> tag, which is a link tag?

The alt attribute is just alternative text specified for an image, like this one: alt="A brown bear".

As regards your code, yes the right way of formatting an image with a link around it would be

<a><img></a>

However <a> on its own doesn't do much, it needs its attributes, like href, target, etc.

Also, be careful with white spaces in your code... this might throw errors on CC that will not allow you to pass the exercise.

...image_brownbear.jpg"target= "_blank" alt="A brown bear "/>

---> ...image_brownbear.jpg" target="_blank" alt="A brown bear" />

<a href = "https://en.wikipedia.org/wiki/Brown_bear" target = "_blank" >Learn more </a>

---> <a href="https://en.wikipedia.org/wiki/Brown_bear" target="_blank">Learn more</a>


#3

Thanks for all the help so far.
Yes I did mean the tag.

Best regards,
{GoalBike}

You need to know what to do when the sun is not shining
~ Robert Downey Jr.