Lesson: HTML5 and CSS
Turn an Image into a Link
You can make elements into links by nesting them within an a
element.
Nest your image within an a
element. Here's an example:
<a href="#"><img src="https://bit.ly/fcc-running-cats" alt="Three kittens running towards the camera. "></a>
Remember to use #
as your a
element's href
property in order to turn it into a dead link.
Place the existing image element within an anchor element.
Once you've done this, hover over your image with your cursor. Your cursor's normal pointer should become the link clicking pointer. The photo is now a link.
The content on this page is licensed under Attribution-ShareAlike 4.0 International. Original authors: freeCodeCamp, the content was modified.