[html] Difference between <input type='submit' /> and <button type='submit'>text</button>

There are many legends about them. I want to know the truth. What are the differences between the two following examples?

  1. <input type='submit' value='text' />

  2. <button type='submit'>text</button>

This question is related to html button

The answer is


With <button>, you can use img tags, etc. where text is

<button type='submit'> text -- can be img etc.  </button>

with <input> type, you are limited to text


In summary :

<input type="submit">

<button type="submit"> Submit </button>

Both by default will visually draw a button that performs the same action (submit the form).

However, it is recommended to use <button type="submit"> because it has better semantics, better ARIA support and it is easier to style.