HTML input src Attribute
HTML <input> tag
Definition and Usage
The src attribute specifies the URL of the image to display as a button.
The src attribute should always be set when the type attribute of the input element is set
to "image".
Syntax
Syntax Example
<input src="input_image.gif" />
|
Attribute Values
Value |
Description |
URL |
Specifies URL of the image Possible values:
- An absolute URL - Is used to navigate to another web site (like
src="http://www.w3schools.com/image.gif")
- A relative URL - Is used to navigate within a site (like
src="image.gif")
Note: This attribute is optional. However, it should be
required whenever the input type is set to "image". |
Browser Support
The attribute is supported in all major browsers.
Example
<form action="">
<input type="image" src="input_image.gif" alt="W3Schools button" />
</form>
|
Try-It-Yourself Demos
input src
attribute example
How use the src attribute with the input type="image".
HTML <input> tag
|