Home » Core Java » Using Image as Link in HTML

Using Image as Link in HTML

<a> is used for creating hyperlink.
Any thing which is placed between <a> and </a> becomes a hyperlink and when it is clicked , it is redirected to the location put in href attribute of <a> tag.

e.g. <a href = “http://www.google.com”>google.com</a>



So, if an image is placed between <a> and </a>, then it behaves as a link and when the image is clicked, it will redirect to the location put in href attribute of <a> tag.


<!DOCTYPE html>
<html>
<head>
    <title>Image as Link</title>
</head>
<body>
      <p>Using Image as Link. Click on the below Image</p>
      <a href="https://www.google.com">
         <img src="java-e1464184781120.png" width="150" height="150">
      </a>
</body>
</html>