Time to stop using the button element

The but­ton ele­ment was redis­covered by Kevin Hale of Wufoo and Particle­tree fame and while read­ing through the post, think­ing I gave you feed­back dur­ing the Wufoo beta about the but­ton ele­ment and it took you this long to see its’ advant­ages. I star­ted read­ing the com­ments, one com­ment from Rus­sell Beat­tie stopped me in my tracks.

Just to expand on the above com­ment about prob­lems with WindowsCE/PocketPC — it’s not just those devices, but all mobile browsers that con­form to the XHTML-MP (mobile pro­file) stand­ard because (pre­sum­ably) it’s based on XHTML-Basic, which doesn’t include the but­ton ele­ment. I tested this on a couple phones I have and sure enough, the but­ton ele­ments aren’t even displayed.

I checked with my mobile and the but­ton ele­ment failed, images and text inside the ele­ment dis­played, but the but­ton failed to work. So I read the XHTML-MP spe­cific­a­tions (PDF) and sure enough the form sup­port is only for :

  • form
  • input
  • label
  • option
  • select
  • tex­tarea

There is also lim­ited sup­port for field­set and optgroup.

Last year I cham­pioned the but­ton ele­ment, going as far a doing a present­a­tion on but­ton the for­got­ten ele­ment to the Perth WSG. Now I will strongly coun­sel against using the but­ton ele­ment because it is not sup­por­ted in mobile browsers and mobile are a big part of the future of the web.

I will change my pos­i­tion about the but­ton ele­ment once it is sup­por­ted by the major­ity of mobile browsers, but until then do not use the but­ton element.

4 Responses to “Time to stop using the button element”

  1. Gary Barber Says:

    Good spot.

    Yeah I noticed this on a site test. But was too busy to check the spec and just replaced with inputs to get the job out the door. Good warn­ing. We should all read the specs! Add it too the list.. groan..

  2. Al Says:

    Wow, thats good to know. I think i have about a hun­dred forms to fix next week…

  3. Buttons – forgotten and immobile — Tyssen Design Says:

    […] As Nick points out in a more recent post, Time to stop using the but­ton ele­ment, it seems that the but­ton ele­ment is not part of the XHTML-MP spe­cific­a­tion (PDF, 400K) which is a shame because as I wrote last year, and more recently by Kevin Hale of Particle­tree, but­tons provide you with more styl­ing flex­ib­il­ity than inputs and you can do some cool stuff with them. […]

  4. Kay Smoljak Says:

    I know I’m late to the party on this, but over the past month I’ve been play­ing with the inter­net on my mobile a lot, and here’s what I’ve found: 99.998% of web sites that were not spe­cific­ally designed and format­ted for a mobile device are unus­able on said mobile device. Devices are still in the cow­boy years. I’m not giv­ing up on but­tons because of mobile devices just yet.