English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

HTML Tag大全

HTML: <input> src attribute

The src attribute of the input element specifies the URL of the image used as the submit button, the src attribute is required for <input type ='image'> and can only be used with <input type ='image'>.

 HTML <input> tag

Online Example

A HTML form that includes an image representing the 'submit' button:

!DOCTYPE html>
<html>
<head>
<title>HTML: <input> src attribute - Basic Tutorial Website(oldtoolbag.com)</title>
<body>
<form action="action_page.php">
  First name: <input type="text" name="fname"><br>
  <input type="image" src="submit.gif" alt="Submit" width="48" height="48">
</form>
</html>
Test to see ‹/›


Click the image, the input will be sent to the page named 'action_page.php' on the server.
Note: The image input type will by default send the X and Y coordinates of the click to the server.

Browser Compatibility

IEFirefoxOperaChromeSafari

All major browsers support the src attribute.

Definition and Usage

The src attribute specifies the URL of the image to be used as the submit button.

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

HTML 4.01 With HTML5Differences

None.

Syntax

<input src="URL">

Attribute value

ValueDescription
URLSpecifies the URL of an image as a submit button.
Possible values:
Absolute URL - Points to another website (such as SRC = 'http://www.example.com/submit.gif')
Relative URL - Points to a file within a website (such as SRC = 'submit.gif')
 HTML <input> tag