Code Editor
Web Browser

You've probably visited websites where not all links were made up of text. Maybe the links you clicked on were images, or some other form of content.

So far, we've added links that were made up of only text, like the following:

<a href="" target="_blank">Prickly Pear</a>

Text-only links, however, would significantly decrease your flexibility as a web developer!

Thankfully, HTML allows you to turn nearly any element into a link by wrapping that element with an anchor element. With this technique, it's possible to turn images into links by simply wrapping the <img> element with an <a> element.

<a href="" target="_blank"><img src="#" alt="A red prickly pear fruit"/></a>

In the example above, an image of a prickly pear has been turned into a link by wrapping the outside of the <img> element with an <a> element.

Report a Bug
If you see a bug or any other issue with this page, please report it here.