On this page, we cover the steps in linking any image to another page. In the HTML code, you will see a hyperlink tag with the href attribute and an image tag with the src attribute. The a href tag must contain the image tag to be linked to another page. Refer to the example below for an in-depth explanation of these terms.
HTML image link example code
Example explained
First, the paragraph element (
tag) contains the image and hyperlink.
Next, the tag is the hyperlink that is pointing to the Computer Hope website.
Next, the third line contains the tag that is used to show the image. The src attribute tells the browser where the image is located.
Finally, the fourth and fifth line are the closing tags for the “a” and “p” tags opened earlier.
Example code result
In this example, clicking the image takes you to the Computer Hope homepage.
Related information
- How to add pictures to an HTML website.
- How to create images as links with no borders.
- How to create an HTML link on a web page.
- Where can I find free public domain images and pictures?
- Computer Hope media library.
- HTML and web design help and support.