Languages
[Edit]
EN

HTML - image input

0 points
Created by:
Wiktor-Sribiew
560

In this article, we would like to show you how to create and use image input in HTML.

Quick solution:

<input type="image" src="https://dirask.com/static/bucket/1632934722_loupe.svg" />

 

Practical example

In this example, we create image input that represents submit button using loupe (magnifier) SVG image.

// ONLINE-RUNNER:browser;

<!doctype html>
<html>
<body>
  <form>
    <label>
      <span>User avatar: </span>
      <br />
      <input type="image" 
             src="https://dirask.com/static/bucket/1632934722_loupe.svg" 
             width="50px"
             height="50px"
             alt="User avatar" />
    </label>
  </form>
</body>
</html>

Note:

The alt attribute is used by SEO and when the image is not loaded correctly alt text appears.

References

Alternative titles

  1. HTML - input type image
  2. HTML - img input
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

HTML - input element types

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join