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>

How to create hyperlinks in HTML

Hyperlinks in HTML Can be created using <a> tag in HTML.

href attribute of <a> tag lets you to put the destination of the web page.

e.g. <a href=”https://www.timesofindia.com”> Times of India </a>


Example of Hyperlinks in HTML:

The below example of HTML illustrates how to create hyperlink in HTML. When href is blank , then if you click on the hyperlink , it remains on the same page(nothing happens on click). In the below example, if you click on “Blank Href Link” it would still remain on the same page, it does not redirect to any other location.

<!DOCTYPE html>
<html>
<head>
    <title> Hyperlink Example in HTML</title>
</head>
<body>

<a href="https://www.google.com"> google </a><br/>
<a href="https://www.timesofindia.com"> Times Of India </a><br/>
<a href=""> Blank Href Link</a>
</body>
</html>