Are there any drawbacks to using <button> instead of <input type="submit"> if I'm not supporting IE6/7?

StackOverflow https://stackoverflow.com/questions/17057079

  •  31-05-2022
  •  | 
  •  

Question

The reason for my question is I'd like to use a search icon from an icon font, which I can't think of a good way to do with an input. I know IE6 and maybe 7 had some quirks with buttons, but if I'm not supporting those, are there any drawbacks to just using a <button> tag?

With a <button> tag I can just use the required html inside the tag.

Was it helpful?

Solution

The button element represents a button labeled by its contents.

A <button> can contain phrasing content (except for other interactive content such as <input>).

In my experience there's no problem using a <button> instead of an <input type=button>. IE7- will submit the <button>'s contents, which is odd. That's pretty much all you have to worry about, though.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top