In this lesson, we’re going to learn how to wrap an <img> element in an anchor element to turn the image into a link. The link could be an internal or external link.
Steps
Add anchor element
Type a and press Tab. Add the URL http://example.com/ as the value for the href attribute.
Add image element
Press Enter in between the tags twice to create a blank line in between the tags. Type img and then press Tab.
For this example, we’ll reuse the laptop image again. Type laptop.jpeg as the value for the src attribute.
Check preview
Make sure your preview is open in your browser so you can try the external link. Try clicking on the image. If you did everything correctly, it should take you to example.com.