Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML5 input versus button

Tags:

html

I'm just wondering if input is part of the HTML5 spec or is button the better way or is there something else even better to use.

<input type="submit" value="submit"/>

<button type="submit">submit</button>
like image 598
Venus Avatar asked Jun 06 '13 13:06

Venus


2 Answers

From the MDC docs:

"<button> elements are much easier to style than <input> elements. You can add inner HTML content (think <em>, <strong> or even <img>), and make use of :after and :before pseudo-element to achieve complex rendering while <input> only accepts a text value attribute."

like image 50
Russell Zahniser Avatar answered Oct 17 '22 06:10

Russell Zahniser


Their difference lies in how you use them. Whilst their basic function is the same the main difference is that you can put HTML in a <button> element.

<button> also is known to have issues in some versions of IE (IE6)

like image 24
Colin Bacon Avatar answered Oct 17 '22 07:10

Colin Bacon