Techstacker
Light ModeDark ModeReset dark mode. Falls back to OS dark mode setting.

Pages

No results for 'undefined'

Blog Posts

No results for 'undefined'
Powered by Algolia

How to Make An Image Into a Clickable Link

Nov 23, 20191 min readHTMLViews:

To make an image into a clickable link that works just like a regular link, you need to wrap it inside an HTML anchor element.

The structure of your anchor element is the same as if you add a regular link inside a text block in a blog post, but instead of wrapping your anchor (link) element inside paragraph tags (<p></p>) you wrap your image element (<img>) inside anchor tags <a></a>.

<a href="https://techstacker.com">
<img src="https://upload.wikimedia.org/wikipedia/en/7/77/EricCartman.png" width="150" height="150" alt="Eric Cartman" />
</a> 

The result:

Eric Cartman

If you click on the image you will be taken to the front page.