CSS CSS Selectors Selectors - Beyond the Basics DRY CSS

Arikaturika Tumojenko
Arikaturika Tumojenko
8,897 Points

The difference between <input type="submit"> and <button type="submit">?

I had issues understanding why in the previous video we were styling elements that didn't exist on the page (respectively the button element) until I realized that <input type="submit" value="login"> it counts as a button.

In the "HTML forms" track (with Nick Pettit) I only saw this form

<button type="submit">Sign up</button>

IS there a real difference between them. Are they used in different circumstances? When do we use the input tag and when do we use the button tag? Thank you!

Christian Lawrence
Christian Lawrence
3,941 Points

My understanding of this is that the <button> tag is for on page interactions only e.g. postcode look up. Whereas, <input type="submit" value="login"> sends data but also moves the user to another screen e.g. my account.

1 Answer

Ben Schroeder
Ben Schroeder
22,814 Points

You can put HTML in a <button>, which is very handy for design.