Skip to content
Related Articles

Related Articles

How to turn an Image into a Link in HTML ?
  • Difficulty Level : Easy
  • Last Updated : 05 Jan, 2021

The purpose of this article is to turn an HTML image into a webpage link.

Approach: The HTML <a> type attribute is used to create a hyperlink to web pages, files, locations on the same page. We can make elements like images into links by nesting them within an <a> element. It defines a hyperlink which is used to link from one page to another. If the <a> tag has no href attribute, then it will be only a placeholder for a hyperlink.

Syntax:

<a href=""></a>

Note: The href attribute is used to specify the destination address of the link.

Example:



HTML

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
  
<body style="text-align: center;">
    <h3>
        Click on GeeksforGeeks logo to 
        Redirect into geeksforgeeks.org
    </h3>
  
    <a href="https://geeksforgeeks.org">
        <img src=
            alt="Click to visit geeksforgeeks.org">
    </a>
</body>
  
</html>

chevron_right


Output: We can see the webpage. If you click on the logo of GeeksforGeeks then you will be redirected to the web page www.geeksforgeeks.org

After Clicking on Logo: It will redirect to GeeksforGeeks home page.

full-stack-img

My Personal Notes arrow_drop_up
Recommended Articles
Page :