3 Demos of How to Create HTML image links

3 Demos of How to Create HTML image links

Image links in HTML

You can use images that are linked to the other web pages of your website or some other websites. In order to link the images to the other web pages, you can nest the <a> tag with <img> tag. Or use the img tag inside the HTML link tag.

The example below shows how to link an image to another web page.

Experience this online

As you can see, after the <a href> the img tag is used. In place of the anchor text, you will place image tag to be displayed and linked with the href URL.

An image link example if image is not available

The example below shows if somehow the image is not loaded, or wrong path or wrong image name is given then how alternate text will be visible. For the demo, we have used the wrong image name.

HTML image link alt

Experience this online

HTML image link with inline CSS

The example below uses the Style attribute with CSS properties to make a link of an image.

HTML image link

Experience this online

Also see HTML forms | The href | HTML tutorial