How to Use Images as Buttons in HTML? Last Updated : 21 May, 2025 Comments Improve Suggest changes Like Article Like Report Images can work like buttons to make a website more interactive and visually appealing. Over 70% of modern websites include image-based elements to enhance user experience. This article shows different ways to turn images into clickable buttons using simple HTML.1. Using the img Tag Inside the Button ElementWe can wrap the <img> tag inside a <button> element. This technique is useful for creating interactive buttons that feature custom images, while still utilizing the semantic and interactive features of the <button> element. index.html <button type="button"onclick="alert('Image Button clicked!')"> <img src="https://media.geeksforgeeks.org/wp-content/uploads/20240905154658/gfglogo.jpg" alt="Button Image" style="width: 50px; height: 50px;"> </button> OutputUsing img tag inside button element2. Using <button> Element with Background ImagesThis approach involves applying a background image to a standard <button> element. It provides the flexibility of using CSS for styling and interaction effects. The button element in HTML creates a clickable button on your web page, By default, it has text or a label, but you can customize it to include images or styles. index.html <!DOCTYPE html> <html> <head> <style> .image-button { width: 100px; height: 100px; background-image: url( 'https://media.geeksforgeeks.org/wp-content/uploads/20240905154658/gfglogo.jpg'); background-size: cover; border: none; cursor: pointer; } </style> </head> <body> <button class="image-button" onclick="alert('Button clicked!')"> </button> </body> </html> OutputUsing button element with background images3. Using <input> Element with Image TypeWe will use the <input> element with type="image". It creates an image-based submit button that can be used in forms. This approach is straightforward and adds a nice visual touch to you site. IN HTML, <input> element is used to create interactive controls in a web form. index.html <form action="/submit-url" method="post"> <input type="image" src= "https://media.geeksforgeeks.org/wp-content/uploads/20240905154658/gfglogo.jpg" alt="Submit" width="100" height="50"> </form> Output Comment More infoAdvertise with us Next Article How to Use Images as Buttons in HTML? Y yuvrajghule281 Follow Improve Article Tags : Web Technologies HTML Similar Reads How to use URL of the image as a submit button in HTML ? The HTML <input> type attribute is used to specify the type of <input> element to display. The default type of <input> type attribute is text. In this article, we set the image as button value. It creates the image as the submit button. Syntax: <input type="image"> Attribute 1 min read How to Add Button in HTML? Buttons in HTML are interactive elements that users can click to trigger certain actions, such as submitting forms, navigating to different pages, or executing JavaScript functions. We can use either the <button> tag or <input type="button"> tag to create a button.1. Using <button> 1 min read How to add icons in the button in HTML ? Adding icons in buttons in HTML involves including visual symbols or images within buttons to enhance their appearance and usability. This can be done using icon libraries like Font Awesome, Bootstrap Icons, or Material Icons, or by inserting images directly with <img> tags for visual cues.Add 3 min read How to Insert an Image in HTML? To insert an image in HTML, you can use <img> tag. This tag uses the src attribute to define the URL of the image file. We can also use CSS to insert image in HTML.Table of ContentUsing img TagUsing background-image propertyInsert an Image using img TagThe <img> tag is the primary method 1 min read How to render HTML to an image ? Converting HTML code into an image can be achieved through various methods, such as using the html2canvas JavaScript library or leveraging CSS. This capability is particularly useful for users who wish to share a visual representation of their code without sharing the actual code. This guide will de 3 min read Like