The src attribute is used to specify the path of an image for an <input type="image"> element. It displays the image as a clickable submit button.
- Defines the URL or path of the image to be displayed.
- Used only with <input type="image">.
- Allows images to work as form submit buttons.
Syntax:
<input src="URL">Attribute Values: It contains a single value URL that specifies the link of the source image. There are two types of URL links which are listed below:
- Absolute URL: It points to another webpage.
- Relative URL: It points to other files of the same web page.
<!--Driver Code Starts-->
<!DOCTYPE html>
<html>
<head>
<title>
HTML Input src Attribute
</title>
</head>
<!--Driver Code Ends-->
<body style="text-align:center;">
<h1 style="color:green;">
GeeksForGeeks
</h1>
<h2>HTML Input src Attribute</h2>
<form>
<input id="myImage"
type="image"
src=
"https://media.geeksforgeeks.org/wp-content/uploads/gfg-40.png"
alt="Submit"
width="70"
height="48" />
</form>
</body>
<!--Driver Code Starts-->
</html>
<!--Driver Code Ends-->