Images as Links

You have surely come across an image that is also a link. On YouTube, for example, clicking a video's picture takes you to the page with that video. Let's see how to do that.

<a href="address">
	<img src="image-address" alt="Image description">
</a>

It's simple: we put the image inside the a element, so that it becomes a child of the link. Clicking the image then works just like clicking the text of a link.

We can turn other HTML elements into links the same way: we just put them inside an a element.

Instructions

Wrap the cat image in a new link: right before the img element, write the opening tag <a href="https://en.wikipedia.org/wiki/Cat">, and right after it, the closing tag </a>.

Add the target attribute with the value _blank to this new link, so that it opens in a new tab.

Start programming for free

By signing up, you agree to the Terms of Service and Privacy Policy.

Or sign up with:

8/12