EN
HTML - image input
0
points
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 correctlyalt
text appears.