Languages
[Edit]
EN

HTML - image input

0 points
Created by:
Wiktor-Sribiew
350

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

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