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
 |
|
Get Your Diploma!
W3Schools' Online Certification Program is the perfect solution for busy
professionals who need to balance work, family, and career building.
The HTML Certificate is for developers who want to document their knowledge of HTML, XHTML, and CSS.
The JavaScript Certificate is for developers who want to document their knowledge of JavaScript and the HTML DOM.
The XML Certificate is for developers who want to document their knowledge of XML, XML DOM and XSLT.
The ASP Certificate is for developers who want to document their knowledge of ASP, SQL, and ADO.
The PHP Certificate is for developers who want to document their knowledge of PHP and SQL (MySQL).
|
|