How to link an image to another page in HTML

Updated: 06/22/2018 by Computer Hope
<a> tag in HTML

In the HTML code for a web page, you should use a hyperlink tag with the href attribute, as well as an image tag with the source attribute when you want to create a link using an image. Refer to the example below for an in-depth explanation of what this means.

HTML image link example code

<p><a href=""><img src=""></a></p>

Example explained

First of all, you have the paragraph element in which the image hyperlink sits; this is denoted using the <p> tag. Inside of that element, you have the link itself, which is wrapped in the <a> tag. This tag lets the browser know that you're creating a link. The href attribute is used to designate the destination website or web page. The <img> tag is used to add an image to the link, and the src attribute tells the browser where the image resource is located on the Internet.

Example code result

Computer Hope Logo

In this example, clicking on the image takes you to the Computer Hope homepage.