HTML Image Submit Buttons: Labels and Coordinates
An image can submit a form
An input of type image is a submit button rendered using an image. src supplies the image and alt describes the action. This example embeds its image so it needs no external asset. The destination is illustrative; do not activate it to send data.
<form action="/search"> <label> Query <input name="q" value="HTML"> </label> <input type="image" src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22100%22%20height%3D%2240%22%3E%3Crect%20width%3D%22100%22%20height%3D%2240%22%20fill%3D%22navy%22%2F%3E%3Ctext%20x%3D%2212%22%20y%3D%2225%22%20fill%3D%22white%22%3ESend%3C%2Ftext%3E%3C%2Fsvg%3E" alt="Search catalog" width="100" height="40"></form>The image acts as a submit control with the name Search catalog.
Coordinate data
An image submitter sends its selected coordinates rather than an ordinary button value. When it has name="pick", the entries are pick.x and pick.y; without a name they are x and y. An activation without a pointer position uses zero coordinates.
<form> <input type="image" name="pick" src="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22100%22%20height%3D%2240%22%3E%3Crect%20width%3D%22100%22%20height%3D%2240%22%20fill%3D%22navy%22%2F%3E%3Ctext%20x%3D%2212%22%20y%3D%2225%22%20fill%3D%22white%22%3ESend%3C%2Ftext%3E%3C%2Fsvg%3E" alt="Choose point" width="100" height="40"></form>A server could receive pick.x and pick.y. This snippet does not process a request.
Prefer a normal button for ordinary actions
When coordinates are unnecessary, use a button with text or an image and text. Unlike an image submit input, a named submit button can supply a regular value. This often makes the action clearer.
<form> <button type="submit" name="action" value="save">Save draft</button></form>The chosen submitter contributes action=save.
Common mistakes and practice
An image submit button is not an image map. Use meaningful alt text rather than a file name. Avoid workflows that require precise pointer coordinates without providing an accessible alternative.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
HTML Image Submit Buttons: Labels and Coordinates — Knowledge Check
Apply the control concepts taught in this lesson.
What is the purpose of input type=image?
Which keys are sent for name="pick"?
Which control is preferable for a plain Save action?
Which attribute communicates the action of an image submit control to users who cannot see it?
For an unnamed image submitter, what are the coordinate entry names?