Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Or use the <button> element with the text-indent background image trick. That works in IE6.


Came to say the same thing. Even better is just leaving out the background-image/text-indent trick altogether, and using the image's alt tag:

<button><img src="/img/sign_up_button.png" alt="Sign Up" /></button>

The versatility of the <button> element is really remarkable, and it works fine in all browsers. I highly recommend anyone currently using <input type="submit"> to change to <button type="submit">


I recommend just staying away from the button element unless you are really careful now and in the future. I started using it a couple years ago almost exclusively and quickly ran into problem #1 below and not until just recently #2 which probably resulted in a lot of bugs that just never got reported or we just got lucky.

1. IE does not honor the value attribute of the button tag, rather it submits the button html content as the value.

2. IE6 passes ALL button elements to the action page of the form, not just the one clicked.

There are javascript onsubmit hacks to work around both of these issues but it is just really annoying to have to do so, and easy to over look. It might work fine at first with one button but then you add a second or rely on the button value a year later and don't test in IE6 and you are screwed.


The button element has some issues with what it submits as its value, which might not be a problem if you're using it as a substitute for a single submit button in a form, as in this case, but it's still worth noting.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: