Latest web development tutorials

HTML input src attribute

HTML input Tag Reference HTML <input> tag

Examples

With an image submit button HTML form:

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

try it"

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the src attribute.


Definition and Usage

Src attribute specifies the URL submit button displayed as an image.

Note: src attribute for the <input type = "image"> attribute is required, and only used with <input type = "image"> used in conjunction.


Differences between HTML 4.01 and HTML5

no.


grammar

<input src="URL">

Property Value

描述
URL 规定作为提交按钮来使用的图像的 URL。

可能的值:

  • 绝对 URL - 指向另一个网站(比如 src="http://www.example.com/submit.gif")
  • 相对 URL - 指向网站内的一个文件(比如 src="submit.gif")


HTML input Tag Reference HTML <input> tag