HTML <input> srcAttribute

HTML input 标签参考手册HTML <input> Tag

Examples

HTML form with an image submit button:

<form action="demo_form.html">
  First name: <input type="text" name="fname"><br>
  <input type="image" src="submit.gif.html" alt="Submit">
</form>

Try it Yourself »

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the src attribute.


Definition and Usage

The src attribute specifies the URL of the image displayed as the submit button.

Note:The src attribute is required for <input type="image"> and can only be used with <input type="image">.


Differences between HTML 4.01 and HTML5

None.


Syntax

<input src="URL.html">

Attribute Values

Value Description
URL Specifies the URL of the image to be used as the submit button.

Possible values:

  • Absolute URL - points to another website (e.g. src="http://www.example.com/submit.gif")
  • Relative URL - points to a file within the website (e.g. src="submit.gif.html")


HTML input 标签参考手册HTML <input> Tag Other Extensions